community / community.general / 6.6.8 / module / lxd_profile Manage LXD profiles Authors: Hiroaki Nakamura (@hnakamur)community.general.lxd_profile (6.6.8) — module
Install with ansible-galaxy collection install community.general:==6.6.8
collections: - name: community.general version: 6.6.8
Management of LXD profiles
# An example for creating a profile - hosts: localhost connection: local tasks: - name: Create a profile community.general.lxd_profile: name: macvlan state: present config: {} description: my macvlan profile devices: eth0: nictype: macvlan parent: br0 type: nic
# An example for creating a profile in project mytestproject - hosts: localhost connection: local tasks: - name: Create a profile community.general.lxd_profile: name: testprofile project: mytestproject state: present config: {} description: test profile in project mytestproject devices: {}
# An example for creating a profile via http connection - hosts: localhost connection: local tasks: - name: Create macvlan profile community.general.lxd_profile: url: https://127.0.0.1:8443 # These client_cert and client_key values are equal to the default values. #client_cert: "{{ lookup('env', 'HOME') }}/.config/lxc/client.crt" #client_key: "{{ lookup('env', 'HOME') }}/.config/lxc/client.key" trust_password: mypassword name: macvlan state: present config: {} description: my macvlan profile devices: eth0: nictype: macvlan parent: br0 type: nic
# An example for modify/merge a profile - hosts: localhost connection: local tasks: - name: Merge a profile community.general.lxd_profile: merge_profile: true name: macvlan state: present config: {} description: my macvlan profile devices: eth0: nictype: macvlan parent: br0 type: nic
# An example for deleting a profile - hosts: localhost connection: local tasks: - name: Delete a profile community.general.lxd_profile: name: macvlan state: absent
# An example for renaming a profile - hosts: localhost connection: local tasks: - name: Rename a profile community.general.lxd_profile: name: macvlan new_name: macvlan2 state: present
url: default: unix:/var/lib/lxd/unix.socket description: - The unix domain socket path or the https URL for the LXD server. required: false type: str name: description: - Name of a profile. required: true type: str state: choices: - present - absent default: present description: - Define the state of a profile. required: false type: str config: description: - 'The config for the instance (e.g. {"limits.memory": "4GB"}). See U(https://github.com/lxc/lxd/blob/master/doc/rest-api.md#patch-3)' - If the profile already exists and its "config" value in metadata obtained from GET /1.0/profiles/<name> U(https://github.com/lxc/lxd/blob/master/doc/rest-api.md#get-19) are different, they this module tries to apply the configurations. - Not all config values are supported to apply the existing profile. Maybe you need to delete and recreate a profile. required: false type: dict devices: description: - 'The devices for the profile (e.g. {"rootfs": {"path": "/dev/kvm", "type": "unix-char"}). See U(https://github.com/lxc/lxd/blob/master/doc/rest-api.md#patch-3)' required: false type: dict project: description: - Project of a profile. See U(https://github.com/lxc/lxd/blob/master/doc/projects.md). required: false type: str version_added: 4.8.0 version_added_collection: community.general new_name: description: - A new name of a profile. - If this parameter is specified a profile will be renamed to this name. See U(https://github.com/lxc/lxd/blob/master/doc/rest-api.md#post-11) required: false type: str snap_url: default: unix:/var/snap/lxd/common/lxd/unix.socket description: - The unix domain socket path when LXD is installed by snap package manager. required: false type: str client_key: aliases: - key_file description: - The client certificate key file path. - If not specified, it defaults to C($HOME/.config/lxc/client.key). required: false type: path client_cert: aliases: - cert_file description: - The client certificate file path. - If not specified, it defaults to C($HOME/.config/lxc/client.crt). required: false type: path description: description: - Description of the profile. type: str merge_profile: default: false description: - Merge the configuration of the present profile with the new desired configuration, instead of replacing it. required: false type: bool version_added: 2.1.0 version_added_collection: community.general trust_password: description: - The client trusted password. - You need to set this password on the LXD server before running this module using the following command. lxc config set core.trust_password <some random password> See U(https://www.stgraber.org/2016/04/18/lxd-api-direct-interaction/) - If trust_password is set, this module send a request for authentication before sending any requests. required: false type: str
actions: description: List of actions performed for the profile. returned: success sample: - create type: list logs: description: The logs of requests and responses. returned: when ansible-playbook is invoked with -vvvv. sample: (too long to be placed here) type: list old_state: description: The old state of the profile returned: success sample: absent type: str