summaryrefslogtreecommitdiffstats
path: root/lib/ansible/playbooks/configure_undercloud.yml
blob: c0e1cd358d3fcf54204cfc977229d3875c6e81e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.highlight .no { color: #66d9ef } /* Name.Constant */
.highlight .nd { color: #a6e22e } /* Name.Decorator */
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
.highlight .ne { color: #a6e22e } /* Name.Exception */
.highlight .nf { color: #a6e22e } /* Name.Function */
.highlight .nl { color: #f8f8f2 } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #a6e22e } /* Name.Other */
.highlight .py { color: #f8f8f2 } /* Name.Property */
.highlight .nt { color: #f92672 } /* Name.Tag */
.highlight .nv { color: #f8f8f2 } /* Name.Variable */
.highlight .ow { color: #f92672 } /* Operator.Word */
.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
.highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
.highlight 
---
- hosts: all
  tasks:
    - name: Generate SSH key for stack if missing
      shell: test -e ~/.ssh/id_rsa || ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
    - name: Fix ssh key for stack
      shell: restorecon -r /home/stack
      become: yes
    - file:
        path: /home/stack/nics
        state: directory
        owner: stack
        group: stack
        mode: 0775
    - copy:
        src: /root/.ssh/id_rsa.pub
        dest: /home/stack/jumphost_id_rsa.pub
        owner: stack
        group: stack
        mode: 0644
    - copy:
        src: "{{ apex_temp_dir }}/{{ item }}.yaml"
        dest: "/home/stack/nics/{{ item }}.yaml"
        owner: stack
        group: stack
        mode: 0644
      with_items:
        - controller
        - compute
    - lineinfile:
        path: /etc/sudoers
        regexp: 'Defaults\s*requiretty'
        state: absent
      become: yes
    - name: openstack-configs undercloud
      shell: openstack-config --set undercloud.conf DEFAULT {{ item }}
      with_items: "{{ undercloud_config }}"
    - name: openstack-configs ironic
      shell: openstack-config --set /etc/ironic/ironic.conf {{ item }}
      become: yes
      with_items: "{{ ironic_config }}"
    - name: openstack-configs undercloud aarch64
      shell: openstack-config --set undercloud.conf DEFAULT ipxe_enabled false
      when: aarch64
    - lineinfile:
        path: /usr/lib/python2.7/site-packages/ironic/common/pxe_utils.py
        regexp: '_link_ip_address_pxe_configs'
        line: '        _link_mac_pxe_configs(task)'
      when: aarch64
    - block:
        - name: undercloud install
          shell: openstack undercloud install &> apex-undercloud-install.log
          become: yes
          become_user: stack
      rescue:
        - name: undercloud install retry
          shell: openstack undercloud install >> apex-undercloud-install.log 2>&1
          become: yes
          become_user: stack
      always:
        - name: fetch undercloud log
          fetch:
            src: /home/stack/apex-undercloud-install.log
            dest: "{{ apex_temp_dir }}/"
            flat: yes
    - name: openstack-configs nova
      shell: openstack-config --set /etc/nova/nova.conf DEFAULT {{ item }}
      become: yes
      with_items: "{{ nova_config }}"
    - name: restart nova services
      service:
        name: "{{ item }}"
        state: restarted
        enabled: yes
      with_items:
        - openstack-nova-conductor
        - openstack-nova-compute
        - openstack-nova-api
        - openstack-nova-scheduler
    - name: openstack-configs neutron
      shell: openstack-config --set /etc/neutron/neutron.conf DEFAULT {{ item }}
      become: yes
      with_items: "{{ neutron_config }}"
    - name: restart neutron services
      service:
        name: "{{ item }}"
        state: restarted
        enabled: yes
      with_items:
        - neutron-server
        - neutron-dhcp-agent
    - name: configure external network vlan ifcfg
      template:
        src: external_vlan_ifcfg.yml.j2
        dest: "/etc/sysconfig/network-scripts/ifcfg-vlan{{ external_network.vlan }}"
        owner: root
        group: root
        mode: 0644
      become: yes
      when:
        - external_network.vlan != "native"
        - external_network.enabled
    - name: bring up vlan ifcfg
      shell: "ifup vlan{{ external_network.vlan }}"
      become: yes
      when:
        - external_network.vlan != "native"
        - external_network.enabled
    - name: assign IP to native eth2
      shell: ip a a {{ external_network.ip }}/{{ external_network.prefix }} dev eth2
      become: yes
      when:
        - external_network.vlan == "native"
        - external_network.enabled
        - not aarch64
    - name: bring up eth2
      shell: ip link set up dev eth2
      when:
        - external_network.vlan == "native"
        - external_network.enabled
        - not aarch64
      become: yes
    - name: assign IP to native eth0 if aarch64
      shell: ip a a {{ external_network.ip }}/{{ external_network.prefix }} dev eth0
      become: yes
      when:
        - external_network.vlan == "native"
        - external_network.enabled
        - aarch64
    - name: bring up eth0 if aarch64
      shell: ip link set up dev eth0
      when:
        - external_network.vlan == "native"
        - external_network.enabled
        - aarch64
      become: yes
    - name: fetch storage environment file
      fetch:
        src: /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml
        dest: "{{ apex_temp_dir }}/"
        flat: yes

- include: undercloud_aarch64.yml
  when: aarch64