Skip to content

Commit f37e350

Browse files
authored
Merge pull request #48 from stackhpc/master-workflows
feat: automatic update of workflows master
2 parents e040a44 + 553ccab commit f37e350

File tree

9 files changed

+44
-56
lines changed

9 files changed

+44
-56
lines changed

.ansible-lint

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
---
22
skip_list:
3-
- '701' # meta/main.yml should contain relevant info
3+
- var-naming[no-role-prefix]
4+
- galaxy[no-changelog]
5+
- meta-runtime[unsupported-version]
6+
- fqcn[action-core]
7+
- fqcn[action]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name: Ansible collection linters
3+
'on':
4+
pull_request:
5+
jobs:
6+
lint:
7+
uses: stackhpc/.github/.github/workflows/lint-collection.yml@main
8+
with:
9+
lint_pip_dependencies: "git+https://github.com/stackhpc/ansible-modules-hashivault@stackhpc"

.github/workflows/pull_request.yml

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,13 @@
1-
21
name: Tests
32

43
# Controls when the action will run.
5-
on:
4+
'on':
65
pull_request:
76
push:
87
branches:
98
- master
109

1110
jobs:
12-
lint:
13-
runs-on: ubuntu-latest
14-
strategy:
15-
fail-fast: false
16-
matrix:
17-
ansible:
18-
- "2.9"
19-
- "2.10"
20-
- "2.12"
21-
steps:
22-
# Checks-out the repository under $GITHUB_WORKSPACE, so it's accessible to the job
23-
- uses: actions/checkout@v3
24-
25-
- name: Install dependencies
26-
run: |
27-
pipx uninstall ansible-core
28-
python3 -m pip install --upgrade pip
29-
if [[ "${{ matrix.ansible }}" = "2.9" ]]; then
30-
ansible_package=ansible
31-
elif [[ "${{ matrix.ansible }}" = "2.10" ]]; then
32-
ansible_package=ansible
33-
else
34-
ansible_package=ansible-core
35-
fi
36-
pip3 install $ansible_package==${{ matrix.ansible }}.* 'ansible-lint==5.*'
37-
38-
- name: Linting code
39-
run: |
40-
ansible-lint -v --force-color
41-
4211
integration:
4312
runs-on: ubuntu-latest
4413
strategy:

galaxy.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
namespace: "stackhpc"
2-
name: "hashicorp"
1+
namespace: stackhpc
2+
name: hashicorp
3+
description: >
4+
Hashicorp Vault/Consul deployment and configuration
35
version: "2.4.0"
46
readme: "README.md"
57
authors:
@@ -9,7 +11,9 @@ dependencies:
911
license:
1012
- "Apache-2.0"
1113
tags:
14+
- consul
1215
- hashicorp
16+
- infrastructure
17+
- security
1318
- vault
14-
- consul
1519
repository: "https://github.com/stackhpc/ansible-collection-hashicorp"

roles/vault/tasks/vault.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
until: vault_init_status.status == 200
2727

2828
- name: "Initialize vault"
29+
run_once: true
30+
when:
31+
- not vault_init_status.json.initialized
2932
block:
3033
- name: Initialize vault
3134
hashivault_init:
@@ -50,10 +53,7 @@
5053
copy:
5154
content: "{{ vault_keys_result | to_nice_json }}"
5255
dest: "{{ vault_write_keys_file_path }}"
53-
mode: 0600
56+
mode: "0600"
5457
delegate_to: "{{ vault_write_keys_file_host }}"
5558
when:
5659
- vault_write_keys_file | bool
57-
run_once: true
58-
when:
59-
- not vault_init_status.json.initialized

roles/vault_pki/tasks/create_cert.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
{{ item.data.issuing_ca }}
3434
{{ item.data.private_key }}
3535
dest: "{{ vault_pki_certificates_directory }}/{{ cert_name | replace(' ', '-') }}.pem"
36-
mode: 0600
36+
mode: "0600"
3737
delegate_to: "{{ vault_pki_write_certificates_host }}"
3838
loop: "{{ cert_data.results }}"
3939
loop_control:
@@ -52,7 +52,7 @@
5252
{{ item.data.certificate }}
5353
{{ item.data.issuing_ca }}
5454
dest: "{{ vault_pki_certificates_directory }}/{{ cert_name | replace(' ', '-') }}.crt"
55-
mode: 0600
55+
mode: "0600"
5656
delegate_to: "{{ vault_pki_write_certificates_host }}"
5757
loop: "{{ cert_data.results }}"
5858
loop_control:
@@ -61,7 +61,7 @@
6161
- not vault_pki_write_pem_bundle | bool
6262
- vault_pki_write_certificate_files | bool
6363
- not cert_file.stat.exists or vault_pki_overwrite_certificates | bool
64-
64+
6565
- name: "Write out key"
6666
vars:
6767
cert_name: "{{ item.item.common_name if item.item.common_name | default() | length > 0 else item.item.extra_params.ip_sans | default() }}"
@@ -70,7 +70,7 @@
7070
content: |
7171
{{ item.data.private_key }}
7272
dest: "{{ vault_pki_certificates_directory }}/{{ cert_name | replace(' ', '-') }}.key"
73-
mode: 0600
73+
mode: "0600"
7474
delegate_to: "{{ vault_pki_write_certificates_host }}"
7575
loop: "{{ cert_data.results }}"
7676
loop_control:

roles/vault_pki/tasks/intermediate.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
max_lease_ttl: "{{ vault_pki_intermediate_max_lease_ttl }}"
1313

1414
- name: "Generate Intermediate CA cert, key and sign CSR"
15+
when: not vault_pki_intermediate_import | bool
1516
block:
1617
- name: "Generate Vault Intermediate CA cert and key"
1718
hashivault_pki_ca:
@@ -73,7 +74,7 @@
7374
content: |
7475
{{ intermediate_ca_csr_signed.data.certificate }}
7576
dest: "{{ vault_pki_certificates_directory }}/{{ vault_pki_intermediate_ca_name | replace(' ', '-') }}.crt"
76-
mode: 0600
77+
mode: "0600"
7778
delegate_to: "{{ vault_pki_write_certificates_host }}"
7879
when:
7980
- vault_pki_write_int_ca_to_file | bool
@@ -85,17 +86,17 @@
8586
{{ intermediate_ca_csr_signed.data.issuing_ca }}
8687
{{ intermediate_ca_csr.data.private_key }}
8788
dest: "{{ vault_pki_certificates_directory }}/{{ vault_pki_intermediate_ca_name |replace(' ', '-') }}.pem"
88-
mode: 0600
89+
mode: "0600"
8990
delegate_to: "{{ vault_pki_write_certificates_host }}"
9091
when:
9192
- vault_pki_intermediate_export | bool
9293
- intermediate_ca_csr.changed
9394
- intermediate_ca_csr.data is defined
9495
- intermediate_ca_csr_signed.data is defined
9596

96-
when: not vault_pki_intermediate_import | bool
9797

9898
- name: "Import Intermediate CA cert and key"
99+
when: vault_pki_intermediate_import | bool
99100
block:
100101
- name: "Import Intermediate CA cert and key"
101102
hashivault_pki_ca_set:
@@ -104,5 +105,3 @@
104105
ca_cert: "{{ vault_ca_cert | default(omit) }}"
105106
mount_point: "{{ vault_pki_intermediate_ca_name }}"
106107
pem_bundle: "{{ vault_pki_intermediate_ca_bundle }}"
107-
108-
when: vault_pki_intermediate_import | bool

roles/vault_pki/tasks/root.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
content: |
3131
{{ root_ca_data.data.certificate }}
3232
dest: "{{ vault_pki_certificates_directory }}/{{ vault_pki_root_ca_name | replace(' ', '-') }}.pem"
33-
mode: 0600
33+
mode: "0600"
3434
delegate_to: "{{ vault_pki_write_certificates_host }}"
3535
when:
3636
- root_ca_data.data.certificate is defined

tests/test_vault.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
file:
1414
path: /etc/vault
1515
state: directory
16+
mode: "0700"
1617
become: true
1718

18-
- include_role:
19+
- name: Include vault role
20+
include_role:
1921
name: vault
2022

21-
# Idempotence test
22-
- include_role:
23+
- name: Include vault role (idemoptence test)
24+
include_role:
2325
name: vault
2426

2527
- name: Unseal vault
@@ -97,14 +99,15 @@
9799
- OS-CERT-TEST.crt
98100
- OS-CERT-TEST2.pem
99101

100-
- name: concatenate CAs
102+
- name: Concatenate CAs
101103
shell: |
102104
cat /tmp/OS-TLS-ROOT.pem /tmp/OS-TLS-INT.crt > /tmp/CA-CHAIN.pem
103105
args:
104106
executable: /bin/bash
105107
become: true
108+
changed_when: true
106109

107-
- name: verify certificate chain
110+
- name: Verify certificate chain
108111
command: |
109112
openssl verify -CAfile /tmp/CA-CHAIN.pem
110113
/tmp/{{ item }}
@@ -113,4 +116,4 @@
113116
loop:
114117
- OS-CERT-TEST.crt
115118
- OS-CERT-TEST2.pem
116-
119+
changed_when: false

0 commit comments

Comments
 (0)