aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.ansible-lint3
-rw-r--r--.github/workflows/pr.yml4
-rw-r--r--handlers/main.yml2
-rw-r--r--meta/main.yml41
-rw-r--r--tasks/rundeck.yml9
-rw-r--r--tests/rundeck_files/test.yaml5
-rw-r--r--tests/test.yml4
-rw-r--r--vars/main.yml2
8 files changed, 42 insertions, 28 deletions
diff --git a/.ansible-lint b/.ansible-lint
new file mode 100644
index 0000000..f747714
--- /dev/null
+++ b/.ansible-lint
@@ -0,0 +1,3 @@
1exclude_paths:
2 - .github
3 - .cache
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:
28 - uses: actions/checkout@v2 28 - uses: actions/checkout@v2
29 with: 29 with:
30 path: "${{ github.repository }}" 30 path: "${{ github.repository }}"
31 - name: Lint Ansible Playbook
32 uses: ansible/ansible-lint-action@master
33 with:
34 targets: "${{ github.repository }}"
31 - run: | 35 - run: |
32 sudo apt update && sudo apt install -y python3-pip 36 sudo apt update && sudo apt install -y python3-pip
33 pip3 install -r ${{ github.repository }}/requirements.txt 37 pip3 install -r ${{ github.repository }}/requirements.txt
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 @@
1--- 1---
2# handlers file for ansible-rundeck-jobs \ No newline at end of file 2# 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 @@
1galaxy_info: 1galaxy_info:
2 author: FretLink 2 author: fretlink
3 description: Love and Truck 3 role_name: rundeck_jobs
4 company: FretLink 4 description: "Love and Truck"
5 company: Fretlink
5 6
6 # If the issue tracker for your role is not on github, uncomment the 7 # If the issue tracker for your role is not on github, uncomment the
7 # next line and provide a value 8 # next line and provide a value
@@ -14,7 +15,7 @@ galaxy_info:
14 # - GPLv3 15 # - GPLv3
15 # - Apache 16 # - Apache
16 # - CC-BY 17 # - CC-BY
17 license: TBD 18 license: BSD
18 19
19 min_ansible_version: 2.5 20 min_ansible_version: 2.5
20 21
@@ -27,15 +28,21 @@ galaxy_info:
27 # this branch. If Travis integration is configured, only notifications for this 28 # this branch. If Travis integration is configured, only notifications for this
28 # branch will be accepted. Otherwise, in all cases, the repo's default branch 29 # branch will be accepted. Otherwise, in all cases, the repo's default branch
29 # (usually master) will be used. 30 # (usually master) will be used.
30 #github_branch: 31 # github_branch:
31 32
32 # 33 #
33 # platforms is a list of platforms, and each platform has a name and a list of versions. 34 # platforms is a list of platforms, and each platform has a name and a list of versions.
34 # 35 #
35 # platforms: 36 platforms:
36 # - name: Fedora 37 - name: Fedora
37 # versions: 38 versions:
38 # - all 39 - all
40 - name: Debian
41 versions:
42 - all
43 - name: Ubuntu
44 versions:
45 - all
39 # - 25 46 # - 25
40 # - name: SomePlatform 47 # - name: SomePlatform
41 # versions: 48 # versions:
@@ -45,13 +52,13 @@ galaxy_info:
45 # - 99.99 52 # - 99.99
46 53
47 galaxy_tags: [] 54 galaxy_tags: []
48 # List tags for your role here, one per line. A tag is a keyword that describes 55 # List tags for your role here, one per line. A tag is a keyword that describes
49 # and categorizes the role. Users find roles by searching for tags. Be sure to 56 # and categorizes the role. Users find roles by searching for tags. Be sure to
50 # remove the '[]' above, if you add tags to this list. 57 # remove the '[]' above, if you add tags to this list.
51 # 58 #
52 # NOTE: A tag is limited to a single word comprised of alphanumeric characters. 59 # NOTE: A tag is limited to a single word comprised of alphanumeric characters.
53 # Maximum 20 tags per role. 60 # Maximum 20 tags per role.
54 61
55dependencies: [] 62dependencies: []
56 # List your role dependencies here, one per line. Be sure to remove the '[]' above, 63# List your role dependencies here, one per line. Be sure to remove the '[]' above,
57 # if you add dependencies to this list. 64# 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 @@
7 7
8- name: Create rundeck jobs 8- name: Create rundeck jobs
9 uri: 9 uri:
10 url: "{{rundeck_api_url }}/{{rundeck_api_version}}/project/{{ rundeck_project }}/jobs/import" 10 url: "{{ rundeck_api_url }}/{{ rundeck_api_version }}/project/{{ rundeck_project }}/jobs/import"
11 method: POST 11 method: POST
12 return_content: true 12 return_content: true
13 body_format: raw 13 body_format: raw
@@ -17,7 +17,7 @@
17 Content-Type: application/x-www-form-urlencoded; charset=utf-8 17 Content-Type: application/x-www-form-urlencoded; charset=utf-8
18 X-Rundeck-Auth-Token: "{{ rundeck_api_token }}" 18 X-Rundeck-Auth-Token: "{{ rundeck_api_token }}"
19 register: rundeck_create_jobs 19 register: rundeck_create_jobs
20 with_items: "{{ rundeck_jobs_files.files}}" 20 with_items: "{{ rundeck_jobs_files.files }}"
21 21
22- name: Check if a job failed 22- name: Check if a job failed
23 fail: 23 fail:
@@ -33,13 +33,14 @@
33 33
34- name: Get all jobs 34- name: Get all jobs
35 uri: 35 uri:
36 url: "{{rundeck_api_url }}/{{rundeck_api_version}}/project/{{ rundeck_project }}/jobs?groupPathExact={{ rundeck_jobs_group | default(rundeck_empty_group_path) }}" 36 url: "{{ rundeck_api_url }}/{{ rundeck_api_version }}/project/{{ rundeck_project }}/jobs?groupPathExact={{ rundeck_group_path }}"
37 method: GET 37 method: GET
38 headers: 38 headers:
39 Accept: application/json 39 Accept: application/json
40 X-Rundeck-Auth-Token: "{{ rundeck_api_token }}" 40 X-Rundeck-Auth-Token: "{{ rundeck_api_token }}"
41 vars: 41 vars:
42 rundeck_empty_group_path: '' 42 rundeck_empty_group_path: ''
43 rundeck_group_path: "{{ rundeck_jobs_group | default(rundeck_empty_group_path) }}"
43 register: rundeck_existing_jobs 44 register: rundeck_existing_jobs
44 when: rundeck_remove_missing 45 when: rundeck_remove_missing
45 46
@@ -54,7 +55,7 @@
54 55
55- name: "Remove jobs not in the directory" 56- name: "Remove jobs not in the directory"
56 uri: 57 uri:
57 url: "{{rundeck_api_url }}/{{rundeck_api_version}}/job/{{ item }}" 58 url: "{{ rundeck_api_url }}/{{ rundeck_api_version }}/job/{{ item }}"
58 method: DELETE 59 method: DELETE
59 headers: 60 headers:
60 Accept: application/json 61 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 @@
1- defaultTab: summary 1- defaultTab: summary
2 description: Test job 2 description: Test job
3 executionEnabled: true 3 executionEnabled: true
4 loglevel: INFO 4 loglevel: INFO
5 name: Test job 2 5 name: Test job 2
@@ -7,7 +7,6 @@
7 scheduleEnabled: true 7 scheduleEnabled: true
8 sequence: 8 sequence:
9 commands: 9 commands:
10 - exec: "false" 10 - exec: "false"
11 keepgoing: false 11 keepgoing: false
12 strategy: node-first 12 strategy: node-first
13
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 @@
4 - role: ../../ansible-rundeck-jobs 4 - role: ../../ansible-rundeck-jobs
5 rundeck_api_url: http://localhost:4440/api 5 rundeck_api_url: http://localhost:4440/api
6 rundeck_project: test 6 rundeck_project: test
7 rundeck_api_token: testtoken 7 rundeck_api_token: testtoken
8 rundeck_jobs_path: rundeck_files 8 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 @@
1--- 1---
2# vars file for ansible-rundeck-jobs \ No newline at end of file 2# vars file for ansible-rundeck-jobs