This is an old revision of the document!
Script shell to start the playbook
# cat /Ansible-Playbook/scripts/cron_download_files.sh
#!/bin/bash # Start playbook to download files unset http_proxy unset https_proxy log="/var/log/ansible/$1.log" playbook='download_file.yml' cd ~/download >> /var/log/ansible/$1.log date >> /var/log/ansible/$1.log >> /var/log/ansible/$1.log ansible-playbook -vvvv $playbook >> /var/log/ansible/$1.log # message monitoring case $? in 0) status="0" message="Success - script:$playbook log:$log" ;; 99) status="2" message="Error : User interrupted execution - script:$playbook log:$log" ;; *) status="2" message="Error - script:$playbook log:$log" ;; esac server=nagiossrv01 echo "$(hostname -s);ansible_download;$status;$message" | /usr/local/nagios/bin/send_nsca -H $server -p 5667 -c /usr/local/nagios/etc/send_nsca.cfg -d ";"
Into ~/download
# ls -lsa ~/download
ansible.cfg .vaultPwd.yml --> password clear for vault download_file.yml
# cat ansible.cfg | grep -v '^#' | sed '/^$/d' [defaults] inventory = ~/inventory/inventory_download host_key_checking = False retry_files_enabled = False pipelining = True ansible_python_interpreter = /usr/bin/python3 inventory_plugins = ~/.ansible/collections/ansible_collections/xxxxx log_path=/var/log/ansible/stdout.log vault_password_file=./.vaultPwd.yml forks = 15 ansible_ssh_extra_args='-C -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' [inventory] enabled_plugins = xxxxx [privilege_escalation] become = True become_method = sudo become_user = ansibuser # cat ~/inventory/inventory_download [linux] linux01 linux02