ansible

  sudo apt-get install ansible

host=127.0.0.1

cat<<EOF | ansible-playbook  /dev/stdin
- hosts: $host

  tasks:
    - name: "ping $host"
      ping:

    - name: "execute a shell command"
      shell: "date; whoami; df -h; set;"
EOF
# 127.0.0.1                  : ok=3    changed=1    unreachable=0    failed=0   



port=50000

cat<<EOF | ansible-playbook /dev/stdin
- hosts: $host

  tasks:
    - name: check open port
      wait_for:
         port: "{{ item }}"
         state: started
      with_items:
        - ${port}
EOF

nc -l ${port}
nc -lu ${port} # TODO UdP

Molecule

mkdir -p molecule-test-folder && cd $_
python3 -m venv .venv
source .venv/bin/activate
pip install -U setuptools pip 'molecule'
molecule --version # molecule, version 2.22
pip install -U setuptools  pip 'molecule[docker]'

molecule init role -r my-new-role
cd my-new-role
rm meta/ -rf
molecule test --all
ansible.txt · Last modified: 2022/04/16 12:22 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki