library/roles/smartgears/install-gcube-key: Now we delete the unwanted keys.

This commit is contained in:
Andrea Dell'Amico 2016-07-20 13:20:37 +02:00
parent 8ad2341f65
commit 0a25209c25
2 changed files with 59 additions and 28 deletions

View File

@ -1,26 +1,55 @@
--- ---
- name: Install the production gcube keys - block:
get_url: url={{ item.url }} dest=/{{ gcube_tomcat_lib_dir }}/{{ item.name }} owner={{ d4science_user }} group={{ d4science_user }} mode=0400 - name: Install the production gcube keys
with_items: get_url: url={{ item.url }} dest=/{{ gcube_tomcat_lib_dir }}/{{ item.name }} owner={{ smartgears_user }} group={{ d4science_user }} mode=0400
- '{{ gcube_prod_key_1 }}' with_items:
- '{{ gcube_prod_key_2 }}' - '{{ gcube_prod_key_1 }}'
- '{{ gcube_prod_key_3 }}' - '{{ gcube_prod_key_2 }}'
when: install_gcube_prod_key - '{{ gcube_prod_key_3 }}'
tags: gcube_key notify: Restart smartgears
when: install_gcube_prod_key
- name: Install the devel gcube keys - name: Remove the production gcube keys
get_url: url={{ item.url }} dest=/{{ gcube_tomcat_lib_dir }}/{{ item.name }} owner={{ d4science_user }} group={{ d4science_user }} mode=0400 file: dest=/{{ gcube_tomcat_lib_dir }}/{{ item.name }} state=absent
with_items: with_items:
- '{{ gcube_dev_key_1 }}' - '{{ gcube_prod_key_1 }}'
- '{{ gcube_dev_key_2 }}' - '{{ gcube_prod_key_2 }}'
- '{{ gcube_dev_key_3 }}' - '{{ gcube_prod_key_3 }}'
when: install_gcube_dev_key notify: Restart smartgears
tags: gcube_key when: not install_gcube_prod_key
- name: Install the preprod gcube keys - name: Install the devel gcube keys
get_url: url={{ item.url }} dest=/{{ gcube_tomcat_lib_dir }}/{{ item.name }} owner={{ smartgears_user }} group={{ smartgears_user }} mode=0400 get_url: url={{ item.url }} dest=/{{ gcube_tomcat_lib_dir }}/{{ item.name }} owner={{ smartgears_user }} group={{ d4science_user }} mode=0400
with_items: with_items:
- '{{ gcube_pre_key_1 }}' - '{{ gcube_dev_key_1 }}'
notify: Restart smartgears - '{{ gcube_dev_key_2 }}'
when: install_gcube_preprod_key - '{{ gcube_dev_key_3 }}'
notify: Restart smartgears
when: install_gcube_dev_key
- name: Remove the devel gcube keys
file: dest=/{{ gcube_tomcat_lib_dir }}/{{ item.name }} state=absent
with_items:
- '{{ gcube_dev_key_1 }}'
- '{{ gcube_dev_key_2 }}'
- '{{ gcube_dev_key_3 }}'
notify: Restart smartgears
when: not install_gcube_dev_key
- name: Install the preprod gcube keys
get_url: url={{ item.url }} dest=/{{ gcube_tomcat_lib_dir }}/{{ item.name }} owner={{ smartgears_user }} group={{ smartgears_user }} mode=0400
with_items:
- '{{ gcube_pre_key_1 }}'
notify: Restart smartgears
when: install_gcube_preprod_key
- name: Remove the preprod gcube keys
file: dest=/{{ gcube_tomcat_lib_dir }}/{{ item.name }} state=absent
with_items:
- '{{ gcube_pre_key_1 }}'
notify: Restart smartgears
when: not install_gcube_preprod_key
become: True
become_user: '{{ smartgears_user }}'
tags: gcube_key tags: gcube_key

View File

@ -14,15 +14,15 @@
- name: Unarchive the smartgears distribution - name: Unarchive the smartgears distribution
become: True become: True
become_user: '{{ d4science_user }}' become_user: '{{ smartgears_user }}'
unarchive: copy=no src={{ smartgears_user_home }}/{{ smartgears_file }} dest={{ smartgears_user_home }} creates={{ smartgears_user_home }}/smartgears-distribution-{{ smartgears_distribution_version }} unarchive: copy=no src={{ smartgears_user_home }}/{{ smartgears_file }} dest={{ smartgears_user_home }} creates={{ smartgears_user_home }}/smartgears-distribution-{{ smartgears_distribution_version }}
when: ( new_smartgears_distribution | changed ) when: ( new_smartgears_distribution | changed )
tags: [ 'smartgears', 'tomcat' ] tags: [ 'smartgears', 'tomcat' ]
- name: Stop the smartgears container before launching the upgrade script - name: Stop the smartgears container before launching the upgrade script
become: True become: True
become_user: '{{ d4science_user }}' become_user: '{{ smartgears_user }}'
shell: /home/{{ d4science_user }}/stopContainer.sh shell: /home/{{ smartgears_user }}/stopContainer.sh
when: smartgears_upgrade when: smartgears_upgrade
tags: [ 'smartgears', 'tomcat', 'stop_smartgears_service' ] tags: [ 'smartgears', 'tomcat', 'stop_smartgears_service' ]
@ -34,7 +34,7 @@
- name: Set the additional tomcat default file as the smartgears user .bashrc - name: Set the additional tomcat default file as the smartgears user .bashrc
become: True become: True
become_user: '{{ d4science_user }}' become_user: '{{ smartgears_user }}'
template: src=tomcat-instance-default.j2 dest={{ item.user_home }}/.bashrc mode=0444 template: src=tomcat-instance-default.j2 dest={{ item.user_home }}/.bashrc mode=0444
with_items: '{{ tomcat_m_instances }}' with_items: '{{ tomcat_m_instances }}'
tags: [ 'smartgears', 'tomcat', 'smartgears_env' ] tags: [ 'smartgears', 'tomcat', 'smartgears_env' ]
@ -48,7 +48,9 @@
tags: [ 'smartgears', 'tomcat' ] tags: [ 'smartgears', 'tomcat' ]
- name: Install the smartgears configuration file - name: Install the smartgears configuration file
template: src=container.xml.j2 dest={{ smartgears_install_path }}/container.xml owner={{ item.user }} group={{ item.user }} become: True
become_user: '{{ smartgears_user }}'
template: src=container.xml.j2 dest={{ smartgears_install_path }}/container.xml
with_items: '{{ tomcat_m_instances }}' with_items: '{{ tomcat_m_instances }}'
register: containerxml_state register: containerxml_state
notify: Restart smartgears notify: Restart smartgears
@ -67,7 +69,7 @@
- name: Change the smartgears log level - name: Change the smartgears log level
become: True become: True
become_user: '{{ d4science_user }}' become_user: '{{ smartgears_user }}'
shell: /usr/local/bin/change-logback-loglevel shell: /usr/local/bin/change-logback-loglevel
tags: [ 'smartgears', 'tomcat', 'smartgears_loglevel' ] tags: [ 'smartgears', 'tomcat', 'smartgears_loglevel' ]