Skip to content

Commit

Permalink
style(shibboleth-sp): fix all linting errors in role
Browse files Browse the repository at this point in the history
WIP rciam#270

WIP rciam#267

Signed-off-by: Bruce Becker <[email protected]>
  • Loading branch information
brucellino committed Mar 21, 2024
1 parent 487bc87 commit 37317a6
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 55 deletions.
2 changes: 1 addition & 1 deletion roles/shibboleth-sp/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ shibboleth_sp_session:
# "none" is the default and does no limiting
# N.B. Consider carefully before using this option as it can allow malicious
# use of your SP as an open redirect
#redirect_limit: "none"
# redirect_limit: "none"

# SSO settings. To allow for >1 IdP, remove entity_id property and adjust
# discovery_url to point to discovery service.
Expand Down
6 changes: 3 additions & 3 deletions roles/shibboleth-sp/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Restart Shibboleth SP
service:
ansible.builtin.service:
name: "{{ shibboleth_sp_service }}"
state: "restarted"
become: yes
state: restarted
become: true
64 changes: 34 additions & 30 deletions roles/shibboleth-sp/tasks/configure-common.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---

- name: Ensure Shibboleth SP SSL certificate is copied
copy:
content: '{{ item.content }}'
ansible.builtin.copy:
content: "{{ item.content }}"
dest: "{{ item.dest }}"
owner: "{{ shibboleth_sp_user }}"
group: "{{ shibboleth_sp_group }}"
Expand All @@ -14,24 +13,29 @@
- content: "{{ shibboleth_sp_ssl_cert_key }}"
dest: "{{ shibboleth_sp_conf_path }}/cert/sp-key.pem"
mode: "0600"
when: shibboleth_sp_ssl_cert_generate|bool == False
become: yes
no_log: yes
when: not (shibboleth_sp_ssl_cert_generate|bool)
become: true
no_log: true
notify:
- Restart Shibboleth SP

- name: Ensure Shibboleth SP self-signed certificate is generated
command: openssl req -newkey rsa:2048 -new -x509 -days 3652 -subj "{{ shibboleth_sp_ssl_cert_subj }}" -nodes -out sp-crt.pem -keyout sp-key.pem
# This should probably use one of the modules from community.crypto
ansible.builtin.command: |-
openssl req \
-newkey rsa:2048 -new -x509 -days 3652 \
-subj "{{ shibboleth_sp_ssl_cert_subj }}" \
-nodes -out sp-crt.pem -keyout sp-key.pem
args:
chdir: "{{ shibboleth_sp_conf_path }}/cert"
creates: "{{ shibboleth_sp_conf_path }}/cert/sp-key.pem"
when: shibboleth_sp_ssl_cert_generate|bool == True
become: yes
when: shibboleth_sp_ssl_cert_generate|bool
become: true
notify:
- Restart Shibboleth SP

- name: Ensure Shibboleth SP certificate is installed
file:
ansible.builtin.file:
state: file
path: "{{ item.path }}"
owner: "{{ shibboleth_sp_user }}"
Expand All @@ -42,42 +46,42 @@
mode: "0644"
- path: "{{ shibboleth_sp_conf_path }}/cert/sp-key.pem"
mode: "0600"
become: yes
become: true

- name: Configure Shibboleth SP main settings
template:
src: "shibboleth2.xml.j2"
ansible.builtin.template:
src: shibboleth2.xml.j2
dest: "{{ shibboleth_sp_conf_path }}/shibboleth2.xml"
owner: "root"
group: "root"
mode: 0644
backup: yes
become: yes
owner: root
group: root
mode: "0644"
backup: true
become: true
notify:
- Restart Shibboleth SP

- name: Configure Shibboleth SP attribute mappings
copy:
ansible.builtin.copy:
src: "{{ shibboleth_sp_attribute_map_file }}"
dest: "{{ shibboleth_sp_conf_path }}/attribute-map.xml"
owner: "root"
group: "root"
mode: 0644
backup: yes
owner: root
group: root
mode: "0644"
backup: true
when: shibboleth_sp_attribute_map_file is defined
become: yes
become: true
notify:
- Restart Shibboleth SP

- name: Configure Shibboleth SP attribute policies
copy:
ansible.builtin.copy:
src: "{{ shibboleth_sp_attribute_policy_file }}"
dest: "{{ shibboleth_sp_conf_path }}/attribute-policy.xml"
owner: "root"
group: "root"
mode: 0644
backup: yes
owner: root
group: root
mode: "0644"
backup: true
when: shibboleth_sp_attribute_policy_file is defined
become: yes
become: true
notify:
- Restart Shibboleth SP
9 changes: 4 additions & 5 deletions roles/shibboleth-sp/tasks/install-Debian.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---

- name: Ensure Shibboleth SP Apache module is installed (Debian)
apt:
ansible.builtin.apt:
name: libapache2-mod-shib2
state: present
update_cache: yes
install_recommends: no
become: yes
update_cache: true
install_recommends: false
become: true
5 changes: 3 additions & 2 deletions roles/shibboleth-sp/tasks/install-common.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
- name: Ensure required Shibboleth SP dirs exist
file:
ansible.builtin.file:
path: "{{ shibboleth_sp_conf_path }}/{{ item }}"
state: directory
owner: "{{ shibboleth_sp_user }}"
group: "{{ shibboleth_sp_group }}"
mode: "0755"
with_items:
- metadata
- cert
become: yes
become: true
4 changes: 2 additions & 2 deletions roles/shibboleth-sp/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
- name: Include Debian Install Tasks
ansible.builtin.include_tasks: install-Debian.yml
when: ansible_os_family == 'Debian'
#- include: install-CentOS.yml
# when: ansible_os_family == 'CentOS
# - include: install-CentOS.yml
# when: ansible_os_family == 'CentOS

- name: Run OS-independent installation tasks
ansible.builtin.include_tasks: install-common.yml
Expand Down
8 changes: 4 additions & 4 deletions roles/shibboleth-sp/vars/Debian-buster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
---

shibboleth_sp_default_version: "3.0"
shibboleth_sp_default_service: "shibd"
shibboleth_sp_default_conf_path: "/etc/shibboleth"
shibboleth_sp_default_user: "_shibd"
shibboleth_sp_default_group: "_shibd"
shibboleth_sp_default_service: shibd
shibboleth_sp_default_conf_path: /etc/shibboleth
shibboleth_sp_default_user: _shibd
shibboleth_sp_default_group: _shibd
8 changes: 4 additions & 4 deletions roles/shibboleth-sp/vars/Debian-jessie.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
---

shibboleth_sp_default_version: "2.5"
shibboleth_sp_default_service: "shibd"
shibboleth_sp_default_conf_path: "/etc/shibboleth"
shibboleth_sp_default_user: "_shibd"
shibboleth_sp_default_group: "_shibd"
shibboleth_sp_default_service: shibd
shibboleth_sp_default_conf_path: /etc/shibboleth
shibboleth_sp_default_user: _shibd
shibboleth_sp_default_group: _shibd
8 changes: 4 additions & 4 deletions roles/shibboleth-sp/vars/Debian-stretch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
---

shibboleth_sp_default_version: "2.6"
shibboleth_sp_default_service: "shibd"
shibboleth_sp_default_conf_path: "/etc/shibboleth"
shibboleth_sp_default_user: "_shibd"
shibboleth_sp_default_group: "_shibd"
shibboleth_sp_default_service: shibd
shibboleth_sp_default_conf_path: /etc/shibboleth
shibboleth_sp_default_user: _shibd
shibboleth_sp_default_group: _shibd

0 comments on commit 37317a6

Please sign in to comment.