--- roles/fas_client/defaults/main.yml | 8 ++++++++ roles/fas_client/templates/fas.conf.j2 | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 roles/fas_client/defaults/main.yml
diff --git a/roles/fas_client/defaults/main.yml b/roles/fas_client/defaults/main.yml new file mode 100644 index 0000000..f0983d2 --- /dev/null +++ b/roles/fas_client/defaults/main.yml @@ -0,0 +1,8 @@ +--- +# defaults file for fas_client +# + +fas_url: https://admin.fedoraproject.org/accounts/ +fas_staging_url: https://admin.stg.fedoraproject.org/accounts/ +fas_home: /home/fedora +fas_home_backup_dir: "{{ fas_home }}.bak" diff --git a/roles/fas_client/templates/fas.conf.j2 b/roles/fas_client/templates/fas.conf.j2 index a27f0ef..995c8e1 100644 --- a/roles/fas_client/templates/fas.conf.j2 +++ b/roles/fas_client/templates/fas.conf.j2 @@ -1,9 +1,9 @@ [global] ; url - Location to fas server {% if env == "staging" %} -url = https://admin.stg.fedoraproject.org/accounts/ +url = {{ fas_url }} {% else %} -url = https://admin.fedoraproject.org/accounts/ +url = {{ fas_staging_url }} {% endif %}
; temp - Location to generate files while user creation process is happening @@ -59,11 +59,11 @@ aliases_template = /etc/aliases.template shell = /bin/bash
; home - the location for fas user home dirs -home = /home/fedora +home = {{ fas_home }}
; home_backup_dir - Location home dirs should get moved to when a user is ; deleted this location should be tmpwatched -home_backup_dir = /home/fedora.bak +home_backup_dir = {{ fas_home_backup_dir }}
; ssh_restricted_app - This is the path to the restricted shell script. It ; will not work automatically for most people though through alterations it
On Thu, Dec 3, 2015 at 10:09 AM Nicolas Chauvet kwizart@gmail.com wrote:
roles/fas_client/defaults/main.yml | 8 ++++++++ roles/fas_client/templates/fas.conf.j2 | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 roles/fas_client/defaults/main.yml
diff --git a/roles/fas_client/defaults/main.yml b/roles/fas_client/defaults/main.yml new file mode 100644 index 0000000..f0983d2 --- /dev/null +++ b/roles/fas_client/defaults/main.yml @@ -0,0 +1,8 @@ +--- +# defaults file for fas_client +#
+fas_url: https://admin.fedoraproject.org/accounts/ +fas_staging_url: https://admin.stg.fedoraproject.org/accounts/ +fas_home: /home/fedora +fas_home_backup_dir: "{{ fas_home }}.bak" diff --git a/roles/fas_client/templates/fas.conf.j2 b/roles/fas_client/templates/fas.conf.j2 index a27f0ef..995c8e1 100644 --- a/roles/fas_client/templates/fas.conf.j2 +++ b/roles/fas_client/templates/fas.conf.j2 @@ -1,9 +1,9 @@ [global] ; url - Location to fas server {% if env == "staging" %} -url = https://admin.stg.fedoraproject.org/accounts/ +url = {{ fas_url }} {% else %} -url = https://admin.fedoraproject.org/accounts/ +url = {{ fas_staging_url }} {% endif %}
The role should be as generic as possible and not try to deal with system
environment if there's no clear/specific behavior tied to this defined environment. Thus, here we should just have: ```url = {{ fas_url }}```
and deal with the env in the playbook, groups_host or hosts.
; temp - Location to generate files while user creation process is happening @@ -59,11 +59,11 @@ aliases_template = /etc/aliases.template shell = /bin/bash
; home - the location for fas user home dirs -home = /home/fedora +home = {{ fas_home }}
How about: {{ fas_home_dir }} - which is more explicit?
; home_backup_dir - Location home dirs should get moved to when a user is ; deleted this location should be tmpwatched -home_backup_dir = /home/fedora.bak +home_backup_dir = {{ fas_home_backup_dir }}
+1
2015-12-03 10:31 GMT+01:00 SmootherFrOgZ lxtnow@gmail.com:
On Thu, Dec 3, 2015 at 10:09 AM Nicolas Chauvet kwizart@gmail.com wrote:
roles/fas_client/defaults/main.yml | 8 ++++++++ roles/fas_client/templates/fas.conf.j2 | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 roles/fas_client/defaults/main.yml
diff --git a/roles/fas_client/defaults/main.yml b/roles/fas_client/defaults/main.yml new file mode 100644 index 0000000..f0983d2 --- /dev/null +++ b/roles/fas_client/defaults/main.yml @@ -0,0 +1,8 @@ +--- +# defaults file for fas_client +#
+fas_url: https://admin.fedoraproject.org/accounts/ +fas_staging_url: https://admin.stg.fedoraproject.org/accounts/ +fas_home: /home/fedora +fas_home_backup_dir: "{{ fas_home }}.bak" diff --git a/roles/fas_client/templates/fas.conf.j2 b/roles/fas_client/templates/fas.conf.j2 index a27f0ef..995c8e1 100644 --- a/roles/fas_client/templates/fas.conf.j2 +++ b/roles/fas_client/templates/fas.conf.j2 @@ -1,9 +1,9 @@ [global] ; url - Location to fas server {% if env == "staging" %} -url = https://admin.stg.fedoraproject.org/accounts/ +url = {{ fas_url }} {% else %} -url = https://admin.fedoraproject.org/accounts/ +url = {{ fas_staging_url }} {% endif %}
The role should be as generic as possible and not try to deal with system
environment if there's no clear/specific behavior tied to this defined environment. Thus, here we should just have: ```url = {{ fas_url }}```
and deal with the env in the playbook, groups_host or hosts.
Fixing to follow your suggestion with v3.
; temp - Location to generate files while user creation process is happening @@ -59,11 +59,11 @@ aliases_template = /etc/aliases.template shell = /bin/bash
; home - the location for fas user home dirs -home = /home/fedora +home = {{ fas_home }}
How about: {{ fas_home_dir }} - which is more explicit?
There is various way to forge arbitrary variable names. I expect that using fas_home constructed after the home variable of the fas.conf file would make it less arbitrary.
; home_backup_dir - Location home dirs should get moved to when a user is ; deleted this location should be tmpwatched -home_backup_dir = /home/fedora.bak +home_backup_dir = {{ fas_home_backup_dir }}
+1
--
Xavier
infrastructure mailing list infrastructure@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/infrastructure@lists.fedoraprojec...
v3: avoid to use env == "staging" v2: fix inverted fas_staging_url/fas_url --- inventory/group_vars/all | 3 +++ inventory/group_vars/staging | 2 ++ roles/fas_client/defaults/main.yml | 7 +++++++ roles/fas_client/templates/fas.conf.j2 | 10 +++------- 4 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 roles/fas_client/defaults/main.yml
diff --git a/inventory/group_vars/all b/inventory/group_vars/all index feff99f..6855f3f 100644 --- a/inventory/group_vars/all +++ b/inventory/group_vars/all @@ -49,6 +49,9 @@ virt_install_command: virt-install -n {{ inventory_hostname }} -r {{ mem_size }} # the staging group and is used in the proxies.yml playbook. wildcard_cert_name: wildcard-2014.fedoraproject.org
+# Default fas url +fas_url: https://admin.fedoraproject.org/accounts/ + # By default, nodes get no fedmsg certs. They need to declare them explicitly. fedmsg_certs: []
diff --git a/inventory/group_vars/staging b/inventory/group_vars/staging index f083e2b..76e4790 100644 --- a/inventory/group_vars/staging +++ b/inventory/group_vars/staging @@ -10,6 +10,8 @@ wildcard_cert_name: wildcard-2014.stg.fedoraproject.org # This only does anything if the host is not RHEL6 collectd_graphite: True
+fas_url: https://admin.stg.fedoraproject.org/accounts/ + fedmsg_prefix: org.fedoraproject fedmsg_env: stg
diff --git a/roles/fas_client/defaults/main.yml b/roles/fas_client/defaults/main.yml new file mode 100644 index 0000000..345e1e4 --- /dev/null +++ b/roles/fas_client/defaults/main.yml @@ -0,0 +1,7 @@ +--- +# defaults file for fas_client +# + +fas_url: https://admin.fedoraproject.org/accounts/ +fas_home: /home/fedora +fas_home_backup_dir: "{{ fas_home }}.bak" diff --git a/roles/fas_client/templates/fas.conf.j2 b/roles/fas_client/templates/fas.conf.j2 index a27f0ef..3e6f8f3 100644 --- a/roles/fas_client/templates/fas.conf.j2 +++ b/roles/fas_client/templates/fas.conf.j2 @@ -1,10 +1,6 @@ [global] ; url - Location to fas server -{% if env == "staging" %} -url = https://admin.stg.fedoraproject.org/accounts/ -{% else %} -url = https://admin.fedoraproject.org/accounts/ -{% endif %} +url = {{ fas_url }}
; temp - Location to generate files while user creation process is happening temp = /var/db @@ -59,11 +55,11 @@ aliases_template = /etc/aliases.template shell = /bin/bash
; home - the location for fas user home dirs -home = /home/fedora +home = {{ fas_home }}
; home_backup_dir - Location home dirs should get moved to when a user is ; deleted this location should be tmpwatched -home_backup_dir = /home/fedora.bak +home_backup_dir = {{ fas_home_backup_dir }}
; ssh_restricted_app - This is the path to the restricted shell script. It ; will not work automatically for most people though through alterations it
On Thu, Dec 3, 2015 at 11:17 PM Nicolas Chauvet kwizart@gmail.com wrote:
v3: avoid to use env == "staging" v2: fix inverted fas_staging_url/fas_url
inventory/group_vars/all | 3 +++ inventory/group_vars/staging | 2 ++ roles/fas_client/defaults/main.yml | 7 +++++++ roles/fas_client/templates/fas.conf.j2 | 10 +++------- 4 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 roles/fas_client/defaults/main.yml
diff --git a/inventory/group_vars/all b/inventory/group_vars/all index feff99f..6855f3f 100644 --- a/inventory/group_vars/all +++ b/inventory/group_vars/all @@ -49,6 +49,9 @@ virt_install_command: virt-install -n {{ inventory_hostname }} -r {{ mem_size }} # the staging group and is used in the proxies.yml playbook. wildcard_cert_name: wildcard-2014.fedoraproject.org
+# Default fas url +fas_url: https://admin.fedoraproject.org/accounts/
# By default, nodes get no fedmsg certs. They need to declare them explicitly. fedmsg_certs: []
diff --git a/inventory/group_vars/staging b/inventory/group_vars/staging index f083e2b..76e4790 100644 --- a/inventory/group_vars/staging +++ b/inventory/group_vars/staging @@ -10,6 +10,8 @@ wildcard_cert_name: wildcard-2014.stg.fedoraproject.org # This only does anything if the host is not RHEL6 collectd_graphite: True
+fas_url: https://admin.stg.fedoraproject.org/accounts/
fedmsg_prefix: org.fedoraproject fedmsg_env: stg
diff --git a/roles/fas_client/defaults/main.yml b/roles/fas_client/defaults/main.yml new file mode 100644 index 0000000..345e1e4 --- /dev/null +++ b/roles/fas_client/defaults/main.yml @@ -0,0 +1,7 @@ +--- +# defaults file for fas_client +#
+fas_url: https://admin.fedoraproject.org/accounts/ +fas_home: /home/fedora +fas_home_backup_dir: "{{ fas_home }}.bak" diff --git a/roles/fas_client/templates/fas.conf.j2 b/roles/fas_client/templates/fas.conf.j2 index a27f0ef..3e6f8f3 100644 --- a/roles/fas_client/templates/fas.conf.j2 +++ b/roles/fas_client/templates/fas.conf.j2 @@ -1,10 +1,6 @@ [global] ; url - Location to fas server -{% if env == "staging" %} -url = https://admin.stg.fedoraproject.org/accounts/ -{% else %} -url = https://admin.fedoraproject.org/accounts/ -{% endif %} +url = {{ fas_url }}
; temp - Location to generate files while user creation process is happening temp = /var/db @@ -59,11 +55,11 @@ aliases_template = /etc/aliases.template shell = /bin/bash
; home - the location for fas user home dirs -home = /home/fedora +home = {{ fas_home }}
; home_backup_dir - Location home dirs should get moved to when a user is ; deleted this location should be tmpwatched -home_backup_dir = /home/fedora.bak +home_backup_dir = {{ fas_home_backup_dir }}
; ssh_restricted_app - This is the path to the restricted shell script. It ; will not work automatically for most people though through alterations it -- 1.7.2.1
Excellent, +1 from me.
infrastructure@lists.fedoraproject.org