Skip to content

Instantly share code, notes, and snippets.

@Iliyass
Created August 17, 2020 10:05
Show Gist options
  • Save Iliyass/035ec40b2cc34b1fe87371fa040b306a to your computer and use it in GitHub Desktop.
Save Iliyass/035ec40b2cc34b1fe87371fa040b306a to your computer and use it in GitHub Desktop.
- hosts: localhost
tasks:
- name: OS_* environment variables are required
fail:
msg: Please, login to OVH Cloud, and download openrc.sh\
and execute the script to set the appropriate environment variables
when: lookup('env', 'OS_AUTH_URL') is not defined
- name: Create basic Security Group
os_security_group:
state: present
name: basic
- name: Create global_http Security Group
os_security_group:
state: present
name: global_http
- name: Create swarm Security Group
os_security_group:
state: present
name: swarm
- name: Enable PING for basic security group
os_security_group_rule:
security_group: basic
protocol: icmp
remote_ip_prefix: 0.0.0.0/0
- name: Enable PING for basic security group
os_security_group_rule:
security_group: basic
protocol: tcp
remote_ip_prefix: 0.0.0.0/0
port_range_min: "22"
port_range_max: "22"
- name: Enable TCP 80 for all IPs
os_security_group_rule:
security_group: global_http
protocol: tcp
remote_ip_prefix: 0.0.0.0/0
port_range_min: "80"
port_range_max: "80"
- name: Enable TCP 443 for all IPs
os_security_group_rule:
security_group: global_http
protocol: tcp
remote_ip_prefix: 0.0.0.0/0
port_range_min: "443"
port_range_max: "443"
- name: Enable 2377/tcp Port
os_security_group_rule:
security_group: swarm
protocol: tcp
remote_ip_prefix: 10.0.0.0/16
port_range_min: "2377"
port_range_max: "2377"
- name: Enable 7946/tcp Port
os_security_group_rule:
security_group: swarm
protocol: tcp
remote_ip_prefix: 10.0.0.0/16
port_range_min: "7946"
port_range_max: "7946"
- name: Enable 7946/udp Port
os_security_group_rule:
security_group: swarm
protocol: udp
remote_ip_prefix: 10.0.0.0/16
port_range_min: "7946"
port_range_max: "7946"
- name: Enable 4789/udp Port
os_security_group_rule:
security_group: swarm
protocol: udp
remote_ip_prefix: 10.0.0.0/16
port_range_min: "4789"
port_range_max: "4789"
- name: Create Keypair
os_keypair:
state: present
name: ansible_key
public_key_file: /Users/Username/.ssh/id_rsa.pub
- name: Create Manager Instance
os_server:
state: present
name: el-prod-manager
flavor: r2-15
image: 'Debian 10'
key_name: ansible_key
reuse_ips: no
security_groups:
- global_http
- swarm
- basic
nics:
- net-name: Ext-Net
- net-name: My_Private_Network
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment