Skip to content

Commit

Permalink
Add variables
Browse files Browse the repository at this point in the history
  • Loading branch information
VilleS1 committed Apr 15, 2020
1 parent f63e47a commit 468793c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
7 changes: 5 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ arexmaxtransfertries: 10
unixgroup_dir_ops: "/etc/grid-security/opspool"
unixgroup_dir_fgi: "/etc/grid-security/fgipool"

group_name_ops: "ops"
group_name_fgi: "fgi"

ops_acct_nr: 40
fgi_acct_nr: 200

Expand All @@ -79,8 +82,8 @@ arc_frontend_cluster_nodecpu: "Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz"
arc_frontend_enable_fairshare: True
arc_frontend_fairshare:
- { group: 'local', share: '80000' }
- { group: 'fgi', share: '20000' }
- { group: 'ops', share: '100000' }
- { group: '{{group_name_fgi}}', share: '20000' }
- { group: '{{group_name_ops}}', share: '100000' }

arc_frontend_queue_grid: |
[queue:grid]
Expand Down
34 changes: 17 additions & 17 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
# tasks file for ansible-role-arc-frontend
# tasks file for ansible-role-arc-frontend-6

#- name: copy nordugrid.repo file
# template: src=nordugrid.repo.j2 dest=/etc/yum.repos.d/nordugrid.repo owner=root mode=0644
Expand Down Expand Up @@ -60,12 +60,12 @@

- name: Populate ops pool file
lineinfile: dest="{{ unixgroup_dir_ops }}/pool" line={{ item }} create=yes state=present
with_sequence: start=0 end={{ ops_acct_nr }} format=ops%03d
with_sequence: start=0 end={{ ops_acct_nr }} format={{group_name_ops}}%03d
when: init_griduser_accts|bool

- name: Populate fgi pool file
lineinfile: dest="{{ unixgroup_dir_fgi }}/pool" line={{ item }} create=yes state=present
with_sequence: start=0 end={{ fgi_acct_nr }} format=fgi%03d
with_sequence: start=0 end={{ fgi_acct_nr }} format={{group_name_fgi}}%03d
when: init_griduser_accts|bool

- name: Create UnixGroup for FGI dir
Expand All @@ -81,23 +81,23 @@


- name: Create gridops group
group: name=ops state=present
group: name={{group_name_ops}} state=present
delegate_to: install
when: init_griduser_accts|bool

- name: Create gridfgi group
group: name=fgi state=present
group: name={{group_name_fgi}} state=present
delegate_to: install
when: init_griduser_accts|bool

# Ops users do not need write access for home
- name: Create OPS home dir
file: path="{{arc_frontend_griddir}}/ops" state=directory owner=root mode=0755
file: path="{{arc_frontend_griddir}}/{{group_name_ops}}" state=directory owner=root mode=0755
when: init_griduser_accts|bool

# Fgi users do not need write access for home
- name: Create FGI home dir
file: path="{{arc_frontend_griddir}}/fgi" state=directory owner=root mode=0755
file: path="{{arc_frontend_griddir}}/{{group_name_fgi}}" state=directory owner=root mode=0755
when: init_griduser_accts|bool

- name: Create generic gridnull user
Expand All @@ -117,14 +117,14 @@
when: init_griduser_accts|bool

- name: Create Grid users for OPS
user: name={{item}} state=present home="{{arc_frontend_griddir}}/ops" groups=ops createhome=no
with_sequence: start=0 end={{ops_acct_nr}} format=ops%03d
user: name={{item}} state=present home="{{arc_frontend_griddir}}/{{group_name_ops}}" groups={{group_name_ops}} createhome=no
with_sequence: start=0 end={{ops_acct_nr}} format={{group_name_ops}}%03d
delegate_to: install
when: init_griduser_accts|bool

- name: Create Grid users for FGI
user: name={{item}} state=present home="{{arc_frontend_griddir}}/fgi" groups=fgi createhome=no
with_sequence: start=0 end={{fgi_acct_nr}} format=fgi%03d
user: name={{item}} state=present home="{{arc_frontend_griddir}}/{{group_name_fgi}}" groups={{group_name_fgi}} createhome=no
with_sequence: start=0 end={{fgi_acct_nr}} format={{group_name_fgi}}%03d
delegate_to: install
when: init_griduser_accts|bool

Expand All @@ -134,27 +134,27 @@
when: arc_frontend_nis|bool

- name: Create Slurm user account for OPS 1/2
command: /usr/bin/sacctmgr -i add account ops
command: /usr/bin/sacctmgr -i add account {{group_name_ops}}
delegate_to: install
when: add_slurm_accts|bool and init_griduser_accts|bool
ignore_errors: yes

- name: Create Slurm user account for OPS 2/2
command: /usr/bin/sacctmgr -i add user name={{ item }} account=ops
with_sequence: start=0 end={{ops_acct_nr}} format=ops%03d
command: /usr/bin/sacctmgr -i add user name={{ item }} account={{group_name_ops}}
with_sequence: start=0 end={{ops_acct_nr}} format={{group_name_ops}}%03d
delegate_to: install
when: add_slurm_accts|bool and init_griduser_accts|bool
ignore_errors: yes

- name: Create Slurm user account for FGI 1/2
command: /usr/bin/sacctmgr -i add account fgi
command: /usr/bin/sacctmgr -i add account {{group_name_fgi}}
delegate_to: install
when: add_slurm_accts|bool and init_griduser_accts|bool
ignore_errors: yes

- name: Create Slurm user account for FGI 2/2
command: /usr/bin/sacctmgr -i add user name={{item}} account=fgi
with_sequence: start=0 end={{fgi_acct_nr}} format=fgi%03d
command: /usr/bin/sacctmgr -i add user name={{item}} account={{group_name_fgi}}
with_sequence: start=0 end={{fgi_acct_nr}} format={{group_name_fgi}}%03d
delegate_to: install
when: add_slurm_accts|bool and init_griduser_accts|bool
ignore_errors: yes
Expand Down

0 comments on commit 468793c

Please sign in to comment.