phoenixnap / phoenixnap.bmc / 1.17.0 / module / server_public_network add/remove the server to/from a public network | "added in version" 1.10.0 of phoenixnap.bmc" Authors: Pavle Jojkic (@pajuga) <pavlej@phoenixnap.com>, Goran Jelenic (@goranje) <goranje@phoenixnap.com> preview | supported by certifiedphoenixnap.bmc.server_public_network (1.17.0) — module
Install with ansible-galaxy collection install phoenixnap.bmc:==1.17.0
collections: - name: phoenixnap.bmc version: 1.17.0
add/remove the server to/from a public network
No actual configuration is performed on the operating system.
This module has a dependency on requests
API is documented at U(https://developers.phoenixnap.com/docs/bmc/1/overview).
# All the examples assume that you have file config.yaml with your 'clientId' and 'clientSecret' # in location: ~/.pnap/config.yaml - name: Add the server to a public network. hosts: localhost gather_facts: false vars_files: - ~/.pnap/config.yaml tasks: - name: Add the server to a public network. phoenixnap.bmc.server_public_network: client_id: "{{ clientId }}" client_secret: "{{ clientSecret }}" server_id: e6afba51-7de8-4080-83ab-0f915570659c public_network_id: 60473a6115e34466c9f8f083 ips: - 182.16.0.146 - 182.16.0.147 state: present register: output - name: Print the server public network information ansible.builtin.debug: var: output.server_public_network
- name: Remove the server from public network. hosts: localhost gather_facts: false vars_files: - ~/.pnap/config.yaml tasks: - name: Remove the server from public network. phoenixnap.bmc.server_public_network: client_id: "{{ clientId }}" client_secret: "{{ clientSecret }}" server_id: e6afba51-7de8-4080-83ab-0f915570659c public_network_id: 60473a6115e34466c9f8f083 state: absent register: output - name: Print the server public_network information ansible.builtin.debug: var: output.server_public_network
ips: description: - Configurable/configured IPs on the server. - At least 1 IP address is required. All IPs must be within the network's range. - Setting the force query parameter to true allows you to assign no specific IP addresses by designating an empty array of IPs and assign one or more IP addresses which are already configured on other resource(s) in network. elements: str type: list force: description: - parameter controlling advanced features availability. - Currently applicable for networking. It is advised to use with caution since it might lead to unhealthy setups. type: bool state: choices: - present - absent default: present description: Indicate desired state of the target. type: str client_id: description: Client ID (Application Management) type: str server_id: description: The server's ID. required: true type: str client_secret: description: Client Secret (Application Management) type: str public_network_id: description: The network identifier. required: true type: str
server_public_network: contains: id: description: The network identifier. returned: always sample: 603f3b2cfcaf050643b89a4b type: str ips: description: Configurable/configured IPs on the server. elements: str returned: always sample: - 1182.16.0.146 - 182.16.0.147 type: list statusDescription: description: The status of the assignment to the network. returned: always sample: assigned type: str description: The specified public_network information returned: success type: complex