-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* simplify github workflows * role_name and namespace vars are needed for ansible-lint * bump minimum ansible-version to 2.9 * fix linting * make tests work in containers using systemd * remove now obsolete pytest files - we use ansible asserts now
- Loading branch information
Showing
49 changed files
with
603 additions
and
668 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,3 @@ | ||
--- | ||
skip_list: | ||
# TODO: Fix ansible-lint violations for these errors and remove from skip_list | ||
- "fqcn-builtins" | ||
- "fqcn[action-core]" | ||
- "fqcn[action]" | ||
- "ignore-errors" | ||
- "jinja[spacing]" | ||
- "key-order[task]" | ||
- "no-changed-when" | ||
- "no-free-form" | ||
- "no-handler" | ||
- "risky-file-permissions" | ||
- "schema[meta]" | ||
- "var-naming" | ||
- "var-spacing" | ||
|
||
# Pipefail is a bit more difficult, because the shell shipped in the Docker image used | ||
# by the Molecule tests doesn't recognize the pipefail option. Likewise, we also need to | ||
# make sure that the playbook works for hosts that don't have a modern bash or a default | ||
# shell such as /bin/sh. | ||
- "risky-shell-pipe" | ||
|
||
# These errors should continue to be ignored | ||
- "no-jinja-when" | ||
- "role-name" | ||
exclude_paths: | ||
- .github/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,24 @@ | ||
--- | ||
name: Ansible-lint | ||
name: Ansible Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
branches: [master] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [master] | ||
|
||
jobs: | ||
build: | ||
ansible-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
path: "${{ github.repository }}" | ||
|
||
# This is unfortunately necessary because this role doesn't follow Ansible's rules | ||
# for role naming. If we should manage to rename the role, this task could be | ||
# eliminated. | ||
- name: Configure role symlink | ||
run: | | ||
sudo mkdir -p /usr/share/ansible/roles | ||
sudo ln -s $PWD/${{ github.repository }} /usr/share/ansible/roles/ansible-consul | ||
# Similar to the above, we can't use Ansible's ansible-lint-action workflow because | ||
# it makes too many assumptions for us. We need to install it ourselves and run it | ||
# manually. If we could use that action, the next two steps could be removed. | ||
- name: Install dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install -y python3-pip | ||
sudo pip3 install -r ${{ github.repository }}/requirements.txt | ||
|
||
- name: Run ansible-lint | ||
run: | | ||
ansible-lint --offline -c ${{ github.repository }}/.ansible-lint ${{ github.repository }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Run yamllint | ||
- name: Temporary fix for roles | ||
run: | | ||
yamllint -c ${{ github.repository }}/.yamllint ${{ github.repository }} | ||
mkdir -p /home/runner/.ansible | ||
ln -s /home/runner/work/ansible-consul/ /home/runner/.ansible/roles | ||
- name: Run flake8 | ||
run: | | ||
flake8 ${{ github.repository }} | ||
- name: Lint Ansible Playbook | ||
uses: ansible/ansible-lint@v6 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,12 +33,10 @@ jobs: | |
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
path: "${{ github.repository }}" | ||
|
||
- name: Molecule | ||
uses: gofrolist/[email protected] | ||
with: | ||
molecule_options: --base-config molecule/_shared/base.yml | ||
molecule_args: --scenario-name ${{ matrix.scenario }} | ||
molecule_working_dir: "ansible-community/ansible-consul" | ||
molecule_working_dir: ansible-community/ansible-consul |
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 file contains 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 file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
--- | ||
- name: (Mac) Stop consul service | ||
import_tasks: "stop_consul_mac.yml" | ||
ansible.builtin.import_tasks: | ||
file: stop_consul_mac.yml | ||
|
||
- name: (Mac) Start consul service | ||
import_tasks: "start_consul_mac.yml" | ||
ansible.builtin.import_tasks: | ||
file: start_consul_mac.yml |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
--- | ||
- name: Restart rsyslog | ||
service: | ||
ansible.builtin.service: | ||
name: rsyslog | ||
state: restarted | ||
# Needed to force SysV service manager on Docker for Molecule tests | ||
use: "{{ ansible_service_mgr }}" | ||
when: | ||
- ansible_os_family != "Darwin" | ||
- ansible_os_family != "Windows" | ||
listen: 'restart rsyslog' | ||
listen: restart rsyslog |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
--- | ||
- name: Restart syslog-ng | ||
service: | ||
ansible.builtin.service: | ||
name: syslog-ng | ||
state: restarted | ||
# Needed to force SysV service manager on Docker for Molecule tests | ||
use: "{{ ansible_service_mgr }}" | ||
listen: 'restart syslog-ng' | ||
listen: restart syslog-ng |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
--- | ||
- name: Start consul on Unix | ||
service: | ||
ansible.builtin.service: | ||
name: consul | ||
state: started | ||
# Needed to force SysV service manager on Docker for Molecule tests | ||
use: "{{ ansible_service_mgr }}" | ||
when: | ||
- ansible_os_family != "Darwin" | ||
- ansible_os_family != "Windows" | ||
listen: 'start consul' | ||
listen: start consul | ||
|
||
- name: Start consul on Mac | ||
include_tasks: "{{ role_path }}/handlers/start_consul_mac.yml" | ||
ansible.builtin.include_tasks: "{{ role_path }}/handlers/start_consul_mac.yml" | ||
when: ansible_os_family == "Darwin" | ||
listen: 'start consul' | ||
listen: start consul | ||
|
||
- name: Start consul on Windows | ||
win_service: | ||
ansible.windows.win_service: | ||
name: consul | ||
state: started | ||
when: ansible_os_family == "Windows" | ||
listen: 'start consul' | ||
listen: start consul |
This file contains 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 file contains 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 file contains 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
Oops, something went wrong.