Skip to content

Commit

Permalink
Made fqcn-builtins rule implicit
Browse files Browse the repository at this point in the history
From now on, we will be requiring `fqcn-builtins` by default, matching official Ansible guidelines as
documentation was already updated in that regard.
  • Loading branch information
ssbarnea committed Feb 16, 2022
1 parent 205bfb4 commit dc3c704
Show file tree
Hide file tree
Showing 45 changed files with 19,670 additions and 619 deletions.
8 changes: 4 additions & 4 deletions examples/playbooks/become-user-without-become-failure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
become_user: root

tasks:
- debug:
- ansible.builtin.debug:
msg: hello

- hosts: localhost

tasks:
- name: become_user without become task
command: whoami
ansible.builtin.command: whoami
become_user: postgres
changed_when: false

Expand All @@ -21,7 +21,7 @@
block:
- name: become
become: true
command: whoami
ansible.builtin.command: whoami
- name: become_user
become_user: postgres
command: whoami
ansible.builtin.command: whoami
8 changes: 4 additions & 4 deletions examples/playbooks/become-user-without-become-success.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
become: true

tasks:
- debug:
- ansible.builtin.debug:
msg: hello

- hosts: localhost

tasks:
- name: foo
command: whoami
ansible.builtin.command: whoami
become_user: postgres
become: true
changed_when: false
Expand All @@ -20,7 +20,7 @@

tasks:
- name: Accepts a become from higher scope
command: whoami
ansible.builtin.command: whoami
become_user: postgres
changed_when: false

Expand All @@ -29,6 +29,6 @@

tasks:
- name: Accepts a become from a lower scope
command: whoami
ansible.builtin.command: whoami
become: true
changed_when: false
2 changes: 1 addition & 1 deletion examples/playbooks/become.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

tasks:
- name: clone content repository
git:
ansible.builtin.git:
repo: '{{ archive_services_repo_url }}'
dest: '/home/www'
accept_hostkey: true
Expand Down
8 changes: 4 additions & 4 deletions examples/playbooks/block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
- name: successful debug message
debug: msg='i execute normally'
- name: failure command
command: /bin/false
ansible.builtin.command: /bin/false
changed_when: false
- name: never reached debug message
debug: msg='i never execute, cause ERROR!'
rescue:
- name: exception debug message
debug: msg='I caught an error'
ansible.builtin.debug: msg='I caught an error'
- name: another failure command
command: /bin/false
ansible.builtin.command: /bin/false
changed_when: false
- name: another missed debug message
debug: msg='I also never execute :-('
always:
- name: always reached debug message
debug: msg="this always executes"
ansible.builtin.debug: msg="this always executes"
4 changes: 2 additions & 2 deletions examples/playbooks/blockincludes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
- block:
# - include_tasks: "{{ varnotset }}.yml"
- block:
- include: "{{ varset }}.yml"
- ansible.builtin.include: "{{ varset }}.yml"
- block:
- include_tasks: "tasks/directory with spaces/main.yml"
- ansible.builtin.include_tasks: "tasks/directory with spaces/main.yml"
6 changes: 3 additions & 3 deletions examples/playbooks/blockincludes2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
varset: varset
tasks:
- block:
- include_tasks: tasks/nestedincludes.yml
- ansible.builtin.include_tasks: tasks/nestedincludes.yml
# - block:
# - include_tasks: "{{ varnotset }}.yml"
rescue:
- include_tasks: "{{ varset }}.yml"
- ansible.builtin.include_tasks: "{{ varset }}.yml"
always:
- include_tasks: "tasks/directory with spaces/main.yml"
- ansible.builtin.include_tasks: "tasks/directory with spaces/main.yml"
4 changes: 2 additions & 2 deletions examples/playbooks/command-check-failure.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
- hosts: localhost
tasks:
- name: command without checks
command: echo blah
ansible.builtin.command: echo blah
args:
chdir: X

- name: shell without checks
shell: echo blah
ansible.builtin.shell: echo blah
args:
chdir: X
10 changes: 5 additions & 5 deletions examples/playbooks/command-check-success.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
- hosts: localhost
tasks:
- name: command with creates check
command: echo blah
ansible.builtin.command: echo blah
args:
creates: Z

- name: command with removes check
command: echo blah
ansible.builtin.command: echo blah
args:
removes: Z

- name: command with changed_when
command: echo blah
ansible.builtin.command: echo blah
changed_when: False

- name: command with inline creates
command: creates=Z echo blah
ansible.builtin.command: creates=Z echo blah

- name: command with inline removes
command: removes=Z echo blah
ansible.builtin.command: removes=Z echo blah

- name: command with cmd
command:
Expand Down
2 changes: 1 addition & 1 deletion examples/playbooks/common-include-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
gather_facts: false
tasks:
- name: some include
include: tasks/included-with-lint.yml
ansible.builtin.include: tasks/included-with-lint.yml
2 changes: 1 addition & 1 deletion examples/playbooks/common-include-2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
gather_facts: false
tasks:
- name: some include
include_tasks: tasks/included-with-lint.yml
ansible.builtin.include_tasks: tasks/included-with-lint.yml
4 changes: 2 additions & 2 deletions examples/playbooks/conflicting_action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
- hosts: localhost
tasks:
- name: foo
debug:
ansible.builtin.debug:
msg: bar
command: echo
ansible.builtin.command: echo
# On this file ansible-playbook --syntax-check reports:
# ERROR! conflicting action statements: debug, command
#
Expand Down
2 changes: 1 addition & 1 deletion examples/playbooks/contains_secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
3066
tasks:
- name: just a debug task
debug: msg="hello world"
ansible.builtin.debug: msg="hello world"
2 changes: 1 addition & 1 deletion examples/playbooks/ematcher-rule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
msg: A 3rd BANNED line

- name: bar
command: echo something
ansible.builtin.command: echo something
changed_when: false
26 changes: 13 additions & 13 deletions examples/playbooks/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,43 @@

tasks:
- name: unset variable
action: command echo {{this_variable}} is not set in this playbook
action: ansible.builtin.command echo {{this_variable}} is not set in this playbook

- name: trailing whitespace
action: command echo do nothing
action: ansible.builtin.command echo do nothing

- name: git check
action: git a=b c=d
action: ansible.builtin.git a=b c=d

- name: git check 2
action: git version=HEAD c=d
action: ansible.builtin.git version=HEAD c=d

- name: git check 3
git: version=a1b2c3d4 repo=xyz bobbins=d
ansible.builtin.git: version=a1b2c3d4 repo=xyz bobbins=d

- name: executing git through command
action: command git clone blah
action: ansible.builtin.command git clone blah

- name: executing git through command
action: command chdir=bobbins creates=whatever /usr/bin/git clone blah
action: ansible.builtin.command chdir=bobbins creates=whatever /usr/bin/git clone blah

- name: using git module
action: git repo=blah
action: ansible.builtin.git repo=blah

- name: passing git as an argument to another task
action: debug msg="{{item}}"
action: ansible.builtin.debug msg="{{item}}"
with_items:
- git # yamllint wrong indentation
- bobbins

- name: yum latest
yum: state=latest name=httpd
ansible.builtin.yum: state=latest name=httpd

- debug: msg="debug task without a name"
- ansible.builtin.debug: msg="debug task without a name"

- name: apt latest
apt: state=latest name=apache2
ansible.builtin.apt: state=latest name=apache2

- meta: flush_handlers
- ansible.builtin.meta: flush_handlers
# empty task is currently accepted by ansible as valid code:
-
2 changes: 1 addition & 1 deletion examples/playbooks/include-in-block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
- hosts: all

tasks:
- include_tasks: tasks/include-in-block-inner.yml
- ansible.builtin.include_tasks: tasks/include-in-block-inner.yml
10 changes: 5 additions & 5 deletions examples/playbooks/include.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@


pre_tasks:
- include: tasks/x.yml
- ansible.builtin.include_tasks: tasks/x.yml

roles:
- hello
- { role: more_complex, t: z }

tasks:
- include: tasks/x.yml
- include: tasks/x.yml y=z
- ansible.builtin.include_tasks: tasks/x.yml
- ansible.builtin.include_tasks: tasks/x.yml y=z

handlers:
- include: handlers/y.yml
- ansible.builtin.include_tasks: handlers/y.yml

- include: play.yml
- ansible.builtin.include_tasks: play.yml
2 changes: 1 addition & 1 deletion examples/playbooks/jinja2-when-failure.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- hosts: all
tasks:
- name: test when with jinja2
debug: msg=text
ansible.builtin.debug: msg=text
when: "{{ false }}"

- hosts: all
Expand Down
4 changes: 2 additions & 2 deletions examples/playbooks/jinja2-when-success.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
- hosts: all
tasks:
- name: test when
debug: msg=text
ansible.builtin.debug: msg=text
when: true
- name: test when 2
debug: msg=text2
ansible.builtin.debug: msg=text2
when: 1 = 1

0 comments on commit dc3c704

Please sign in to comment.