Skip to content

Commit

Permalink
Fixes: #3481, Use FQCN at any point I found (#3680)
Browse files Browse the repository at this point in the history
  • Loading branch information
muellerbe authored Oct 13, 2022
1 parent 08ee874 commit 904213a
Show file tree
Hide file tree
Showing 20 changed files with 44 additions and 44 deletions.
4 changes: 2 additions & 2 deletions docs/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ directories:
become: true
tasks:
- name: Initialize role without actually running it
include_role:
ansible.builtin.include_role:
name: my_role
tasks_from: init
Expand Down Expand Up @@ -171,7 +171,7 @@ Now, let's add a task to our ``tasks/main.yml`` like so:
.. code-block:: yaml
- name: Molecule Hello World!
debug:
ansible.builtin.debug:
msg: Hello, World!
We can then tell Molecule to test our role against our instance with:
Expand Down
12 changes: 6 additions & 6 deletions playbooks/snap-pre-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@
become: true
tasks:
- name: Install snapd
package:
ansible.builtin.package:
name: snapd
state: present

- name: Enable snapd service
service:
ansible.builtin.service:
name: snapd.socket
state: started

- when: ansible_os_family == 'Debian'
name: Install snapcraft (debian)
package:
ansible.builtin.package:
name: snapcraft
state: present

- when: ansible_os_family == 'RedHat'
block:
- name: Activate snapd
shell: |
ansible.builtin.shell: |
ln -s /var/lib/snapd/snap /snap
- name: Install snapcraft (redhat)
shell: |
ansible.builtin.shell: |
type snapcraft || snap install --classic snapcraft
- name: Validate snapd install
shell: |
ansible.builtin.shell: |
set -e
snap version
snapcraft version
6 changes: 3 additions & 3 deletions src/molecule/data/validate-dockerfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- image: debian:latest
tasks:
- name: create temporary dockerfiles
tempfile:
ansible.builtin.tempfile:
# sanitize image name to be filename safe
prefix: "molecule-dockerfile-{{ item.image | regex_replace('\/', '-') }}"
suffix: build
Expand All @@ -24,7 +24,7 @@
label: "{{ item.image }}"

- name: expand Dockerfile templates
template:
ansible.builtin.template:
src: Dockerfile.j2
dest: "{{ temp_dockerfiles.results[index].path }}"
register: result
Expand All @@ -51,7 +51,7 @@
register: result

- name: Clean up temporary Dockerfile's
file:
ansible.builtin.file:
path: "{{ item }}"
state: absent
loop: "{{ temp_dockerfiles.results | map(attribute='path') | list }}"
Expand Down
2 changes: 1 addition & 1 deletion src/molecule/test/resources/playbooks/delegated/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
connection: local
gather_facts: false
tasks:
- include: create/docker.yml
- ansible.builtin.include: create/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
connection: local
gather_facts: false
tasks:
- include: destroy/docker.yml
- ansible.builtin.include: destroy/docker.yml
4 changes: 2 additions & 2 deletions src/molecule/test/resources/roles/molecule/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
- name: Create /etc/molecule
file: dest=/etc/molecule
ansible.builtin.file: dest=/etc/molecule
group=root
owner=root
mode=0755
state=directory

- name: Create /etc/molecule/{{ ansible_host }}
copy: dest="/etc/molecule/{{ ansible_host }}"
ansible.builtin.copy: dest="/etc/molecule/{{ ansible_host }}"
group=root
owner=root
mode=0644
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
hosts: localhost
tasks:
- name: "Include sample role from current collection"
include_role:
ansible.builtin.include_role:
name: acme.goodies.get_rich
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- name: "some task inside foo.bar collection"
debug:
ansible.builtin.debug:
msg: "hello world!"
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
connection: local
tasks:
- name: Debug
debug:
ansible.builtin.debug:
msg: "Cleaned up"
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
gather_facts: false
tasks:
- name: Touch a file
command: touch /tmp/cleanup
ansible.builtin.command: touch /tmp/cleanup
args:
creates: /tmp/cleanup
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
gather_facts: false
tasks:
- name: Install requirements for collection community.molecule
pip:
ansible.builtin.pip:
name: molecule
delegate_to: localhost

- name: Validate that collection was installed
debug:
ansible.builtin.debug:
msg: "{{ 'foo' | community.molecule.header }}"

- name: test installed role
include_role:
ansible.builtin.include_role:
name: ssbarnea.ansible_role_helloworld
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,41 @@
gather_facts: false
tasks:
- name: Host vars host_var for host host-group-vars from molecule.yml
debug:
ansible.builtin.debug:
var: host_group_vars_host_molecule_yml

- name: Host vars from host_vars existing directory
debug:
ansible.builtin.debug:
var: host_group_vars_host_vars_dir

- name: Group vars group_var for group example from molecule.yml
debug:
ansible.builtin.debug:
var:
- host_group_vars_example_group_one_molecule_yml
- host_group_vars_example_group_two_molecule_yml

- name: Group vars from group_vars existing directory
debug:
ansible.builtin.debug:
var: host_group_vars_group_vars_dir

- name: Group vars group_var from child group example_1 from molecule.yml
debug:
ansible.builtin.debug:
var: host_group_vars_example_1_child_group_molecule_yml

- name: Variable from extra_host from molecule.yml
debug:
ansible.builtin.debug:
var: hostvars['extra_host']['host_group_vars_extra_host_molecule_yml']

- hosts: example
gather_facts: false
tasks:
- name: Dummy converge of example group
debug:
ansible.builtin.debug:
var: ansible_host

- hosts: example_1
gather_facts: false
tasks:
- name: Dummy converge of child example_1 group
debug:
ansible.builtin.debug:
var: ansible_host
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
gather_facts: false
tasks:
- name: Host vars from host_vars links
debug:
ansible.builtin.debug:
var: host_group_vars_host_vars_linked

- name: Group vars from group_vars links
debug:
ansible.builtin.debug:
var: host_group_vars_group_vars_linked

- name: Variable from extra inventory link
debug:
ansible.builtin.debug:
var: hostvars['extra-host']['host_group_vars_extra_host_linked']
6 changes: 3 additions & 3 deletions src/molecule/test/scenarios/idempotence/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# Taken from https://github.com/ansible-community/molecule/issues/835

- name: Create /tmp/test1
file: name=/tmp/test1 state=directory
ansible.builtin.file: name=/tmp/test1 state=directory

- name: Replace /tmp/test1 by /tmp/test2
shell: ls -ld /tmp/test1 | grep root
ansible.builtin.shell: ls -ld /tmp/test1 | grep root

- name: Fix /tmp/test1 perms
file: name=/tmp/test1 state=directory owner=lp group=lp
ansible.builtin.file: name=/tmp/test1 state=directory owner=lp group=lp
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
gather_facts: false
tasks:
- name: Dummy task
command: /bin/true
ansible.builtin.command: /bin/true
changed_when: false
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
gather_facts: false
tasks:
- name: Dummy task
command: /bin/true
ansible.builtin.command: /bin/true
changed_when: false
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
gather_facts: false
tasks:
- name: Check for test file
stat:
ansible.builtin.stat:
path: /tmp/testfile
register: test_file

- name: Create the test file
file:
ansible.builtin.file:
path: /tmp/testfile
state: touch
when: not test_file.stat.exists
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
no_log: "{{ molecule_no_log }}"
tasks:
- name: Delete the test file as a planned side effect
file:
ansible.builtin.file:
path: /tmp/testfile
state: absent
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
become: true
tasks:
- name: Force a converge failure
command: /bin/false
ansible.builtin.command: /bin/false
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
hosts: all
tasks:
- name: Create /tmp/molecule
file:
ansible.builtin.file:
dest: /etc/molecule
group: root
owner: root
mode: 0755
state: directory

- name: Create /etc/molecule/{{ ansible_hostname }}
copy:
ansible.builtin.copy:
dest: "/etc/molecule/{{ ansible_hostname }}"
group: root
owner: root
Expand Down

0 comments on commit 904213a

Please sign in to comment.