From e2002b4d2e9d3e6383d41bd11a3fa14cef0ab3c0 Mon Sep 17 00:00:00 2001 From: Arthur Cadore <74879952+arthurcadore@users.noreply.github.com> Date: Tue, 23 Apr 2024 13:46:28 -0300 Subject: [PATCH] :sparkles: added playbook shell script to main --- app/startup.sh | 8 +++++++- docker-compose.yml | 1 + playbooks/playbooks.sh | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 playbooks/playbooks.sh diff --git a/app/startup.sh b/app/startup.sh index c196cc5..d95ab2d 100644 --- a/app/startup.sh +++ b/app/startup.sh @@ -23,7 +23,8 @@ mkdir /run/sshd echo "###################################################################" echo "Booting the H3C comware library..." -python3 /ansible/setup.py install +cd /ansible/ +python3 setup.py install echo "###################################################################" echo "displaying the users list and SSH access port..." @@ -34,5 +35,10 @@ netstat -tuln # display the configured users: cat /etc/passwd +echo "###################################################################" +echo "Execute playbooks script..." + +./playbooks.sh + # Keep the script running by tailing /dev/null tail -f /dev/null \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 795255d..5916cc6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,6 +13,7 @@ services: # Mount local directories as volumes inside the container: volumes: - "./inventory/:/ansible/inventory/" + - "./playbooks/playbooks.sh:/ansible/playbooks.sh" - "./playbooks/:/ansible/playbooks/" - "./config/hosts:/etc/hosts" - "./libs/:/ansible/" diff --git a/playbooks/playbooks.sh b/playbooks/playbooks.sh new file mode 100644 index 0000000..b1f9720 --- /dev/null +++ b/playbooks/playbooks.sh @@ -0,0 +1,3 @@ + +## Execute ansible example playbook +ansible-playbook -i inventory/hosts switch.yaml \ No newline at end of file