--- - hosts: bonchvisors remote_user: cephadmin become: true become_user: root become_method: sudo tasks: - name: get public ip address shell: ip a | grep -v virbr0\:\ | grep -A2 br0\:\ | grep inet | awk '{print $2}' | awk -F "/" '{print $1}' args: executable: /bin/bash register: public_ip - name: get private ip address shell: ip a | grep -v virbr0\:\ | grep -A2 br1\:\ | grep inet | awk '{print $2}' | awk -F "/" '{print $1}' args: executable: /bin/bash register: private_ip - name: create nova.conf file copy: src: /etc/ansible/files/nova.conf dest: /etc/nova/nova.conf owner: root group: nova mode: 0640 - name: create neutron.conf file copy: src: /etc/ansible/files/neutron.conf dest: /etc/neutron/neutron.conf owner: root group: neutron mode: 0640 - name: create linuxbridge_agent.ini file copy: src: /etc/ansible/files/linuxbridge_agent.ini dest: /etc/neutron/plugins/ml2/linuxbridge_agent.ini owner: root group: neutron mode: 0640 - name: copy secret.xml file copy: src: /etc/ansible/files/secret.xml dest: /etc/ceph/secret.xml owner: root group: root mode: 0640 - name: copy ml2_conf.ini file copy: src: /etc/ansible/files/ml2_conf.ini dest: /etc/neutron/plugins/ml2/ml2_conf.ini owner: root group: root mode: 0644 - name: copy client.cinder.key file copy: src: /etc/ansible/files/client.cinder.key dest: /etc/ceph/client.cinder.key owner: root group: root mode: 0640 - name: insert public_ip in nova.conf my_ip string lineinfile: path: /etc/nova/nova.conf insertbefore: 'use_neutron=true' line: 'my_ip={{item}}' loop: "{{public_ip.stdout_lines}}" when: public_ip.stdout != "" - name: insert private_ip in linuxbridge_agent.ini local_ip string for overlay network lineinfile: path: /etc/neutron/plugins/ml2/linuxbridge_agent.ini insertafter: '\[vxlan\]' line: 'local_ip={{item}}' loop: "{{private_ip.stdout_lines}}" when: private_ip.stdout != "" # - name: virsh secret define # shell: virsh secret-define --file /etc/ceph/secret.xml # args: # executable: /bin/bash # register: required_uuid # - name: virsh secret set # shell: virsh secret-set-value --secret $(echo {{ item }} | awk '{print $2}') --base64 $(cat /etc/ceph/client.cinder.key) # args: # executable: /bin/bash # loop: "{{required_uuid.stdout_lines}}" # when: required_uuid.stdout != "" # - name: restart libvirtd services # systemd: # state: restarted # enabled: yes # daemon_reload: yes # name: libvirtd.service # - name: restart nova-compute services # systemd: # state: restarted # enabled: yes # daemon_reload: yes # name: openstack-nova-compute.service - name: restart libvirtd services systemd: state: restarted enabled: yes daemon_reload: yes name: libvirtd.service - name: restart neutron-linux-brigde-agent services systemd: state: restarted enabled: yes daemon_reload: yes name: neutron-linuxbridge-agent.service