| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- ---
- # This role contains common plays that will run on all nodes
- - name: ensure group exists
- group:
- name: yunion
- state: present
- - name: ensure user exists
- user:
- name: yunion
- shell: /bin/bash
- groups: yunion
- - name: make cache for centos x86
- shell: |
- yum clean all
- yum -y --disablerepo='*' --enablerepo='yunion*' makecache
- when:
- - is_centos_based is defined
- - name: make cache for debian like os
- shell: "apt-get update"
- when:
- - is_debian_based is defined
- - name: init dirs
- shell: "mkdir -p /etc/docker"
- - name: config ntpd service
- template: src=ntp.conf dest=/etc/ntp.conf
- when: ntpd_server is defined
- - name: sync with ntpd_server
- shell: |
- echo "sync with ntpd {{ ntpd_server }}"
- systemctl stop ntpd
- ntpdate {{ ntpd_server }}; echo $?
- echo "[PASS] sync with ntpd {{ ntpd_server }}"
- when: ntpd_server is defined
- ignore_errors: yes
- changed_when: false
- failed_when: false
- - name: enable services
- service:
- name: "{{ item }}"
- state: started
- enabled: yes
- with_items:
- - "{{ common_services }}"
- when:
- - common_services is defined
- - name: Stop/Disable Depreciated Services If Any
- shell: |
- for service in yunion-host-image yunion-host-sdnagent firewalld
- do
- if [ -f /usr/lib/systemd/system/$service.service ]; then
- systemctl disable --now $service
- fi
- done
- become: true
- args:
- executable: /bin/bash
- ignore_errors: yes
- changed_when: false
- failed_when: false
|