This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Update cache | |
ansible.builtin.package: | |
update_cache: true | |
- name: Install nginx | |
ansible.builtin.package: | |
name: nginx | |
- name: restart nginx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Update cache | |
ansible.builtin.package: | |
update_cache: true | |
- name: Install Nginx | |
ansible.builtin.package: | |
name: nginx | |
- name: Restart Nginx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
└── nginx | |
├── molecule | |
│ └── default | |
│ ├── converge.yml | |
│ ├── molecule.yml | |
│ └── verify.yml | |
└── tasks | |
└── main.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
dependency: | |
name: galaxy | |
driver: | |
name: docker | |
platforms: | |
- name: instance | |
image: quay.io/centos/centos:stream8 | |
pre_build_image: true | |
provisioner: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Converge | |
hosts: all | |
tasks: | |
- name: "Include role" | |
include_role: | |
name: "nginx" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# This is an example playbook to execute Ansible tests. | |
- name: Verify | |
hosts: all | |
gather_facts: false | |
tasks: | |
- name: Get info from Nginx running process | |
ansible.builtin.command: systemctl status nginx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
dependency: | |
name: galaxy | |
driver: | |
name: docker | |
platforms: | |
- name: instance | |
image: quay.io/centos/centos:stream8 | |
pre_build_image: true | |
command: /sbin/init |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get inside the role directory | |
cd ansible_molecule/roles/nginx/ | |
molecule init scenario --driver-name docker default |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~/ansible_molecule/roles/nginx | |
molecule test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python 3 | |
$ pip3 install molecule ansible-lint docker molecule[docker] | |
# Older Python | |
$ pip install molecule ansible-lint docker molecule[docker] |
OlderNewer