From f69666a4d9dc66d77a6d2ccdb59d7f947301bc01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Duchaussois?= Date: Thu, 25 Nov 2021 11:11:25 +0100 Subject: Fix linting errors --- .ansible-lint | 3 +++ handlers/main.yml | 2 +- meta/main.yml | 41 ++++++++++++++++++++++++----------------- tasks/rundeck.yml | 9 +++++---- tests/rundeck_files/test.yaml | 5 ++--- tests/test.yml | 4 ++-- vars/main.yml | 2 +- 7 files changed, 38 insertions(+), 28 deletions(-) create mode 100644 .ansible-lint diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..f747714 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,3 @@ +exclude_paths: + - .github + - .cache diff --git a/handlers/main.yml b/handlers/main.yml index 0cdf3ee..78aacb7 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,2 +1,2 @@ --- -# handlers file for ansible-rundeck-jobs \ No newline at end of file +# handlers file for ansible-rundeck-jobs diff --git a/meta/main.yml b/meta/main.yml index 0e695af..536c81f 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,7 +1,8 @@ galaxy_info: - author: FretLink - description: Love and Truck - company: FretLink + author: fretlink + role_name: rundeck_jobs + description: "Love and Truck" + company: Fretlink # If the issue tracker for your role is not on github, uncomment the # next line and provide a value @@ -14,7 +15,7 @@ galaxy_info: # - GPLv3 # - Apache # - CC-BY - license: TBD + license: BSD min_ansible_version: 2.5 @@ -27,15 +28,21 @@ galaxy_info: # this branch. If Travis integration is configured, only notifications for this # branch will be accepted. Otherwise, in all cases, the repo's default branch # (usually master) will be used. - #github_branch: + # github_branch: # # platforms is a list of platforms, and each platform has a name and a list of versions. # - # platforms: - # - name: Fedora - # versions: - # - all + platforms: + - name: Fedora + versions: + - all + - name: Debian + versions: + - all + - name: Ubuntu + versions: + - all # - 25 # - name: SomePlatform # versions: @@ -45,13 +52,13 @@ galaxy_info: # - 99.99 galaxy_tags: [] - # List tags for your role here, one per line. A tag is a keyword that describes - # and categorizes the role. Users find roles by searching for tags. Be sure to - # remove the '[]' above, if you add tags to this list. - # - # NOTE: A tag is limited to a single word comprised of alphanumeric characters. - # Maximum 20 tags per role. + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. dependencies: [] - # List your role dependencies here, one per line. Be sure to remove the '[]' above, - # if you add dependencies to this list. +# List your role dependencies here, one per line. Be sure to remove the '[]' above, +# if you add dependencies to this list. diff --git a/tasks/rundeck.yml b/tasks/rundeck.yml index 1250d24..aa71570 100644 --- a/tasks/rundeck.yml +++ b/tasks/rundeck.yml @@ -7,7 +7,7 @@ - name: Create rundeck jobs uri: - url: "{{rundeck_api_url }}/{{rundeck_api_version}}/project/{{ rundeck_project }}/jobs/import" + url: "{{ rundeck_api_url }}/{{ rundeck_api_version }}/project/{{ rundeck_project }}/jobs/import" method: POST return_content: true body_format: raw @@ -17,7 +17,7 @@ Content-Type: application/x-www-form-urlencoded; charset=utf-8 X-Rundeck-Auth-Token: "{{ rundeck_api_token }}" register: rundeck_create_jobs - with_items: "{{ rundeck_jobs_files.files}}" + with_items: "{{ rundeck_jobs_files.files }}" - name: Check if a job failed fail: @@ -33,13 +33,14 @@ - name: Get all jobs uri: - url: "{{rundeck_api_url }}/{{rundeck_api_version}}/project/{{ rundeck_project }}/jobs?groupPathExact={{ rundeck_jobs_group | default(rundeck_empty_group_path) }}" + url: "{{ rundeck_api_url }}/{{ rundeck_api_version }}/project/{{ rundeck_project }}/jobs?groupPathExact={{ rundeck_group_path }}" method: GET headers: Accept: application/json X-Rundeck-Auth-Token: "{{ rundeck_api_token }}" vars: rundeck_empty_group_path: '' + rundeck_group_path: "{{ rundeck_jobs_group | default(rundeck_empty_group_path) }}" register: rundeck_existing_jobs when: rundeck_remove_missing @@ -54,7 +55,7 @@ - name: "Remove jobs not in the directory" uri: - url: "{{rundeck_api_url }}/{{rundeck_api_version}}/job/{{ item }}" + url: "{{ rundeck_api_url }}/{{ rundeck_api_version }}/job/{{ item }}" method: DELETE headers: Accept: application/json diff --git a/tests/rundeck_files/test.yaml b/tests/rundeck_files/test.yaml index 19fe18d..06d58a8 100644 --- a/tests/rundeck_files/test.yaml +++ b/tests/rundeck_files/test.yaml @@ -1,5 +1,5 @@ - defaultTab: summary - description: Test job + description: Test job executionEnabled: true loglevel: INFO name: Test job 2 @@ -7,7 +7,6 @@ scheduleEnabled: true sequence: commands: - - exec: "false" + - exec: "false" keepgoing: false strategy: node-first - diff --git a/tests/test.yml b/tests/test.yml index 5d85628..3f5fab1 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -4,5 +4,5 @@ - role: ../../ansible-rundeck-jobs rundeck_api_url: http://localhost:4440/api rundeck_project: test - rundeck_api_token: testtoken - rundeck_jobs_path: rundeck_files + rundeck_api_token: testtoken + rundeck_jobs_path: rundeck_files diff --git a/vars/main.yml b/vars/main.yml index add68e1..631c5d4 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,2 +1,2 @@ --- -# vars file for ansible-rundeck-jobs \ No newline at end of file +# vars file for ansible-rundeck-jobs -- cgit v1.2.3 From 7e22b2dd6f8d4483e7007fe1430ed335360251f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Duchaussois?= Date: Thu, 25 Nov 2021 11:39:59 +0100 Subject: Add ansible-lint --- .github/workflows/pr.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8370128..2e80846 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -28,6 +28,10 @@ jobs: - uses: actions/checkout@v2 with: path: "${{ github.repository }}" + - name: Lint Ansible Playbook + uses: ansible/ansible-lint-action@master + with: + targets: "${{ github.repository }}" - run: | sudo apt update && sudo apt install -y python3-pip pip3 install -r ${{ github.repository }}/requirements.txt -- cgit v1.2.3