diff options
author | Sylvain Desbureaux <sylvain.desbureaux@orange.com> | 2019-01-30 14:36:14 +0100 |
---|---|---|
committer | Sylvain Desbureaux <sylvain.desbureaux@orange.com> | 2019-01-30 14:39:24 +0100 |
commit | 1bc5690a09462237d48e5ed409e985597681898f (patch) | |
tree | f1178f26ba2810a53c0ee770addef50df56d49c4 /ansible-server/src/main/scripts/README | |
parent | dc4950ba68c4c6dadd530f7f808bbb4c9458571d (diff) |
reduce ccsdk-ansible-server image footprint
Project "CIA" scope is to provide smaller and multi architecture docker
images.
This proposition aims to do that for ccsdk-ansible-server.
The current size of this proposal is 139mb compared to the 618Mb image
proposed before (and before actual ansible installation).
Principles used are the following:
1. a "basic" `docker build .` should provide a working image;
2. use the smallest (and multi arch) base image possibe;
3. install necessary stuff only;
4. leverage python best practices for installation;
5. remove installation stuff occuring at run level and move them to
build level.
* Dockerfile is now at the root part;
* ansible configuration file `ansible.cfg` is created and put in
`configuration` folder;
* ansible configuration file `ansible.cfg` is pushed during the
build part with a reproductible process;
* `python` files are on `ansible-server" folder so copying during build
works out of the box;
* yml files are put directly on `ansible-server/Playbooks` so copying
during build works out the box;
* Dockerfile base image is now alpine:3.8;
* `timeout` executable being now from busybox, change in the
command-line call has been made (`--signal` is now `-s` and `-t` is
set before setting the timeout value).
* Only install python and python-pip as alpine package and remove build
dependencies package after use.
* put all python requirements in `requirements.txt` package and launch
pip installation command with this file.
* call directly python main script (`RestServer.py`) as entrypoint and
do the python installation stuff at build time.
- [x] change pom.xml so building parts works
- [ ] consider changing destination folder (`/opt/ansible-server/`) to
the ancient one (`/opt/onap/ccsdk/`) if this is problematic
Change-Id: I5c66f29ca40d9224aef3d230593735b8e0aa1f3b
Issue-ID: INT-816
Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
Diffstat (limited to 'ansible-server/src/main/scripts/README')
-rw-r--r-- | ansible-server/src/main/scripts/README | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/ansible-server/src/main/scripts/README b/ansible-server/src/main/scripts/README deleted file mode 100644 index 9aff2c01..00000000 --- a/ansible-server/src/main/scripts/README +++ /dev/null @@ -1,71 +0,0 @@ -''' -/*- -* ============LICENSE_START======================================================= -* ONAP : APPC -* ================================================================================ -* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. -* ================================================================================ -* Copyright (C) 2017 Amdocs -* ============================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -* ECOMP is a trademark and service mark of AT&T Intellectual Property. -* ============LICENSE_END========================================================= -*/ -''' - -============ -INSTALLATION: -============ - -Python: -------- -sudo apt-get install python2.7 -sudo apt-get install python-pip -pip install requests - -Ansible: --------- -sudo apt-get install software-properties-common -sudo apt-add-repository ppa:ansible/ansible -sudo apt-get update -sudo apt-get install ansible - -++ SQL db: The new version REST API code does not need sql db in ansible server - -============= -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 - -response: {"ExpectedDuration": "60sec", "StatusMessage": "PENDING", "StatusCode": 100} - -- Get results (blocked until test finished): -curl --cacert ~/SshKey/fusion_eric-vm_cert.pem --user "appc:abc123" -H "Content-type: application/json" -X GET "http://0.0.0.0:8000/Dispatch/?Id=10&Type=GetResult" - -response: {"Results": {"localhost": {"GroupName": "host", "StatusMessage": "SUCCESS", "StatusCode": 200}}, "PlaybookName": "ansible_sleep", "Version": "0.00", "Duration": "11.261794", "StatusMessage": "FINISHED", "StatusCode": 200} - -- Delete playbook execution information -curl --cacert ~/SshKey/fusion_eric-vm_cert.pem --user "appc:abc123" -H "Content-type: application/json" -X DELETE http://0.0.0.0:8000/Dispatch/?Id=10 - -response: {"StatusMessage": "PLAYBOOK EXECUTION RECORDS DELETED", "StatusCode": 200} |