X-Git-Url: https://gerrit.onap.org/r/gitweb?p=ccsdk%2Fdistribution.git;a=blobdiff_plain;f=ansible-server%2Fsrc%2Fmain%2Fscripts%2FREADME;h=9aff2c010f70b1d82e50a06543b0618cbce4a059;hp=976a8cf77c472a47a14bbedb61e2c25f33fac67e;hb=dc4950ba68c4c6dadd530f7f808bbb4c9458571d;hpb=dc379274e1cb70a2d7506641e4916f10f019e0fe diff --git a/ansible-server/src/main/scripts/README b/ansible-server/src/main/scripts/README index 976a8cf7..9aff2c01 100644 --- a/ansible-server/src/main/scripts/README +++ b/ansible-server/src/main/scripts/README @@ -3,7 +3,7 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ -* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= @@ -32,7 +32,6 @@ Python: ------- sudo apt-get install python2.7 sudo apt-get install python-pip -pip install PyMySQL pip install requests Ansible: @@ -42,43 +41,7 @@ sudo apt-add-repository ppa:ansible/ansible sudo apt-get update sudo apt-get install ansible -SQL db: N/A for SDNC -------- - -sudo apt-get install mysql-server - -Set root passwd during installation (i.e. password_4_mysql_user_id) - -sudo service mysql restart - -Setup mysql: N/A for SDNC ------------- - -mysql -u [username]-p -mysql -uroot -p - -Create user (i.e. id=mysql_user_id psswd=password_4_mysql_user_id) - CREATE USER 'appc'@'%' IDENTIFIED BY 'password_4_mysql_user_id'; - GRANT ALL PRIVILEGES ON *.* TO 'mysql_user_id'@'%'; - SET PASSWORD FOR 'mysql_user_id'@'%'=PASSWORD('password_4_mysql_user_id'); - -Create schema - CREATE SCHEMA ansible; - show databases; - use ansible; - CREATE TABLE playbook (name VARCHAR(45) NOT NULL, value BLOB, type VARCHAR(60), version VARCHAR(60), PRIMARY KEY (name)); - show tables; - CREATE TABLE inventory (hostname VARCHAR(45) NOT NULL, hostgroup VARCHAR(45), credentials VARCHAR(500), PRIMARY KEY (hostname)); - SHOW COLUMNS FROM playbook; - SHOW COLUMNS FROM inventory; - GRANT ALL PRIVILEGES ON *.* TO 'mysql_user_id'@'%' IDENTIFIED BY 'password_4_mysql_user_id' WITH GRANT OPTION; - GRANT ALL PRIVILEGES ON *.* TO 'ansible'@'%' IDENTIFIED BY 'ansible_agent' WITH GRANT OPTION; - FLUSH PRIVILEGES; - -Load db: N/A for SDNC --------- - -python LoadAnsibleMySql.py +++ SQL db: The new version REST API code does not need sql db in ansible server ============= CODE TESTING: @@ -86,6 +49,11 @@ CODE TESTING: 1. Start RestServer: python RestServer.py 2. Try curl commands (case no secured REST: http & no authentication): +(we will need more samples for testing -Taka@att) + +- curl -H "Content-type:application/json" -X POST -d '{"Id": "ap3929_1548451746", "PlaybookName": "ctpx/R7.0.1/ansible/healthcheck/site.yml", "Timeout": "10", "InventoryNames": "VM", "EnvParameters": {"vnf_instance": "ctpx5000v"}}' http://0.0.0.0:8000/Dispatch + +response: {"StatusMessage": "PLAYBOOK INVENTORY FILE NOT FOUND", "StatusCode": 101} - Request to execute playbook: curl -H "Content-type: application/json" -X POST -d '{"Id": "10", "PlaybookName": "ansible_sleep", "NodeList": ["host"], "Timeout": "60", "EnvParameters": {"Sleep": "10"}}' http://0.0.0.0:8000/Dispatch