Skip to content

Commit 92890df

Browse files
Merge pull request #8 from wcm-io-devops/feature/configurable-dependencies
Introduced variables to enable/disable dependencies, fixed default editor in environment setup, fixed configuration of settings-security.xml when provision an other user than the ssh user.
2 parents 339c3cf + c017ab5 commit 92890df

File tree

7 files changed

+44
-8
lines changed

7 files changed

+44
-8
lines changed

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ This role requires Ansible 2.0 or higher.
3535

3636
Available variables are listed below, along with default values.
3737

38+
controlhost_dependency_maven: true
39+
40+
Enables / disables the maven role dependency.
41+
42+
controlhost_dependency_java: true
43+
44+
Enables / disables the java role dependency.
45+
46+
controlhost_dependency_epel: true
47+
48+
Enables / disables the epel role dependency.
49+
50+
controlhost_dependency_terraform: true
51+
52+
Enables / disables the terraform role dependency.
53+
3854
controlhost_user: "{{ ansible_env.SUDO_USER | default(ansible_env.USER) }}"
3955

4056
The user on the controlhost.

defaults/main.yml

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# Enables / disables the maven role dependency
2+
controlhost_dependency_maven: true
3+
4+
# Enables / disables the java role dependency
5+
controlhost_dependency_java: true
6+
7+
# Enables / disables the epel role dependency
8+
controlhost_dependency_epel: true
9+
10+
# Enables / disables the terraform role dependency
11+
controlhost_dependency_terraform: true
12+
113
# The user on the controlhost
214
controlhost_user: "{{ ansible_env.SUDO_USER | default(ansible_env.USER) }}"
315
# The users group on the controlhost

meta/main.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,34 @@ dependencies:
2828
"dependency",
2929
"dependency.epel"
3030
],
31-
when: ansible_os_family == 'RedHat'
31+
when: [
32+
ansible_os_family == 'RedHat',
33+
controlhost_dependency_epel
34+
]
3235
}
3336
- {
3437
role: srsp.oracle-java,
3538
version: 2.19.1,
3639
tags: [
3740
"dependency",
3841
"dependency.java"
39-
]
42+
],
43+
when: controlhost_dependency_java
4044
}
4145
- {
4246
role: gantsign.maven,
4347
version: 4.0.0,
4448
tags: [
4549
"dependency",
4650
"dependency.maven"
47-
]
51+
],
52+
when: controlhost_dependency_maven
4853
}
4954
- { role: andrewrothstein.terraform,
5055
version: v2.2.10,
5156
tags: [
5257
"dependency",
5358
"dependency.terraform"
54-
]
59+
],
60+
when: controlhost_dependency_terraform
5561
}

tasks/env/setup.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
- name: "env : setup : Configure default editor"
22
blockinfile:
33
path: "{{ controlhost_bashrc }}"
4-
block: "export EDITOR={{ controlhost_bashrc_editor }}"
4+
block: "export EDITOR={{ controlhost_default_editor }}"
55
marker: "# {mark} editor ANSIBLE MANAGED BLOCK"
66
when: controlhost_default_editor is defined
77

tasks/maven/encrypt_password.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
- name: "Maven : encrypt_password : Encrpyt maven server password when maven master password is defined."
22
block:
33
- name: "Maven : encrypt_password : encrypt maven server password"
4-
shell: "mvn --encrypt-password {{ item.password }}"
4+
command: "mvn --encrypt-password {{ item.password }}"
55
register: _maven_encrypted_server_password
66
become_user: "{{ controlhost_user }}"
7+
become: yes
78
no_log: true
89

910
- name: "Maven : encrypt_password : set password fact for server with id : {{ item.id}}"

tasks/maven/setup.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
- name: "Maven : setup: Configure settings-security.xml"
1515
block:
1616
- name: "Maven : setup : create maven master password"
17-
shell: "mvn --encrypt-master-password {{ controlhost_maven_master_password }}"
17+
command: "mvn --encrypt-master-password {{ controlhost_maven_master_password }}"
1818
no_log: true
1919
register: _maven_master_password_result
2020

@@ -31,7 +31,6 @@
3131
group: "{{ controlhost_group }}"
3232
mode: 0640
3333

34-
become_user: "{{ controlhost_user }}"
3534
when:
3635
- _maven_settings_security_stats.stat.exists == false
3736
- controlhost_maven_master_password is defined

tasks/packages/pip.yml

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
name: "pip"
44
state: latest
55
when: controlhost_packages_pip_upgrade
6+
tags:
7+
- skip_ansible_lint
68

79
- name: "packages : pip : Install required PIP packages."
810
pip:

0 commit comments

Comments
 (0)