Integrated proxmox
This commit is contained in:
52
playbooks/kvm.yml
Normal file
52
playbooks/kvm.yml
Normal file
@@ -0,0 +1,52 @@
|
||||
---
|
||||
|
||||
- name: Create machine and set up ip
|
||||
hosts: all
|
||||
user: root
|
||||
gather_facts: no
|
||||
serial: 1
|
||||
tasks:
|
||||
- name: Clone VM
|
||||
delegate_to: localhost
|
||||
proxmox_kvm:
|
||||
api_user: "{{ proxmox_user }}"
|
||||
api_password: "{{ proxmox_password }}"
|
||||
api_host: "{{ proxmox_host }}"
|
||||
clone : "{{ ubuntu_template_vm_name }}"
|
||||
name : '{{ inventory_hostname }}'
|
||||
node : 'rack2'
|
||||
storage : 'SSD1'
|
||||
format : 'qcow2'
|
||||
timeout : 3000
|
||||
register: cloned
|
||||
|
||||
- name: Wait 10 seconds for proxmox to register the new node
|
||||
wait_for: timeout=10
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Start VM
|
||||
delegate_to: localhost
|
||||
proxmox_kvm:
|
||||
api_user: "{{ proxmox_user }}"
|
||||
api_password: "{{ proxmox_password }}"
|
||||
api_host: "{{ proxmox_host }}"
|
||||
name: '{{ inventory_hostname }}'
|
||||
node: rack2
|
||||
state: started
|
||||
when: cloned.changed
|
||||
|
||||
- name: Wait for connection
|
||||
delegate_to: 10.0.0.211
|
||||
wait_for_connection:
|
||||
delay: 60
|
||||
timeout: 180
|
||||
when: cloned.changed
|
||||
|
||||
- include: ../roles/configure-interfaces/tasks/main.yml
|
||||
delegate_to: 10.0.0.211
|
||||
when: cloned.changed
|
||||
|
||||
- name: wait for connection
|
||||
wait_for_connection:
|
||||
delay: 60
|
||||
timeout: 180
|
||||
33
playbooks/lxc-test.yml
Normal file
33
playbooks/lxc-test.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
|
||||
- name: Create LXC
|
||||
hosts: localhost
|
||||
user: cody
|
||||
serial: 100%
|
||||
tasks:
|
||||
- name: Create it
|
||||
proxmox:
|
||||
node: 'rack2'
|
||||
api_user: "{{ proxmox_user }}"
|
||||
api_password: "{{ proxmox_password }}"
|
||||
api_host: "{{ proxmox_host }}"
|
||||
password: "{{ proxmox_password }}"
|
||||
hostname: '{{ inventory_hostname }}'
|
||||
memory: 512
|
||||
cores: 2
|
||||
swap: 4096
|
||||
disk: 50
|
||||
state: present
|
||||
netif: '{"net0":"name=eth0,gw=10.0.0.1,ip={{ ansible_host }}/24,bridge=vmbr0"}'
|
||||
ostemplate: 'local:vztmpl/ubuntu-14.04-standard_14.04-1_amd64.tar.gz'
|
||||
searchdomain: wimer.local
|
||||
pubkey: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDHCdYYL9IWTXyOo4qoTBkn2dlV+EKZdir5ApnLcn7yJtI89Y3UP/X4ZNtI4ZU28bCooBoYryD49XvmBXRPujMP2WR9EL9oMz5fLgow8fjYxp6zMfkBsdDBKaxJN7gx5p0JT2zRFAEmQzP085FjauPT8J7vDm2tgumYgpoze6/BmknISkJ7Ib+Opkig/JI3syHKnRij/mnN70W2lpAISaqvPXTQBX3/VWNPCWunDJfbsmMAIJU+mMDYERFKdIt3J2e8KYjYl9DRecsZFG/xLKNF54U/8LnW8pTLzoPW+Q9sPMg2/GH+JyE3Fv5xr5l+J5bm4j8i4GBuFPL0vIqBjvH cody@codydev'
|
||||
|
||||
- name: Turn in on
|
||||
proxmox:
|
||||
node: 'rack2'
|
||||
api_user: "{{ proxmox_user }}"
|
||||
api_password: "{{ proxmox_password }}"
|
||||
api_host: "{{ proxmox_host }}"
|
||||
hostname: '{{ inventory_hostname }}'
|
||||
state: started
|
||||
@@ -4,6 +4,13 @@
|
||||
# ansible-playbook -i ${project_dir}/hosts ${project_dir}/playbooks/site.yml \
|
||||
# -extra-vars "home_pub_key=<pub-key-location-to-curl> standard_user=<user_name> git_user=<git-user> git_email=<git-email>"
|
||||
|
||||
- name: Install ansible dependencies
|
||||
hosts: all
|
||||
user: root
|
||||
gather_facts: no
|
||||
serial: 100%
|
||||
tasks:
|
||||
- include: ../roles/ansible-dependencies/tasks/main.yml
|
||||
|
||||
- name: Apply common configuration to all nodes
|
||||
hosts: all
|
||||
|
||||
Reference in New Issue
Block a user