{"id":21605995,"url":"https://github.com/archf/ansible-lxc","last_synced_at":"2026-05-17T21:02:05.113Z","repository":{"id":41213981,"uuid":"48763714","full_name":"archf/ansible-lxc","owner":"archf","description":"An ansible role to install and configure lxc on a host","archived":false,"fork":false,"pushed_at":"2016-11-07T16:36:45.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-24T19:16:48.526Z","etag":null,"topics":["ansible"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/archf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-29T19:29:03.000Z","updated_at":"2016-02-05T21:13:11.000Z","dependencies_parsed_at":"2022-09-12T17:41:09.883Z","dependency_job_id":null,"html_url":"https://github.com/archf/ansible-lxc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archf%2Fansible-lxc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archf%2Fansible-lxc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archf%2Fansible-lxc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archf%2Fansible-lxc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/archf","download_url":"https://codeload.github.com/archf/ansible-lxc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244242875,"owners_count":20421958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible"],"created_at":"2024-11-24T20:18:29.051Z","updated_at":"2026-05-17T21:02:05.018Z","avatar_url":"https://github.com/archf.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ansible-lxc\n\nA role to install and configure lxc on a host.\n\n## Requirements\n\n### Ansible version\n\nMinimum required ansible version is 1.8.\n\n### Other considerations\n\nYou have to setup networking. Basically, you have the several options.\n\n  1. Use lxc-net service (on ubuntu)\n  2. Use libvirt `virbr0` bridge.\n  3. Create your own linux brigde.\n  4. Use an openvswitch bridge\n\nIt is not within the scope of this role to alter in any way your network stack. On the opposite, you must specify this role what network infrastructure to use.\n\n\n## Description\n\n- install the packages (if on ubuntu will install the ppa).\n- template lxc config files\n  - system wide files\n  - unprivileged users config file\n\nAfter that, your are ready to spawn lxc containers. Check out my ansible-lxcm\n('m' for manager) role.\n\n\n## Role Variables\n\n### Variables conditionally loaded\n\nThose variables from `vars/*.{yml,json}` are loaded dynamically during task\nruntime using the `include_vars` module.\n\nVariables loaded from `vars/Debian.yml`.\n\n```yaml\n---\n\nlxc_pkgs:\n  - lxc\n  - lxd\n  - lxc-templates\n  - python3-lxc\n  - python-lxc\n  # - lxd-tools\n\n```\n\nVariables loaded from `vars/RedHat.yml`.\n\n```yaml\nlxc_pkgs:\n  - lxc\n  - lxc-extra\n  - lxc-templates\n\n```\n\n### Default vars\n\nDefaults from `defaults/main.yml`.\n\n```yaml\n# defaults file for ansible-lxc\n\nlxc_pkg_state: installed\n\nprivate_dir: \"{{ playbook_dir }}/private\"\n\n# upriviledged users directory to create\nlxc_directories:\n  - '.local/share/lxc'\n  - '.local/share/lxcsnaps'\n  - '.cache/lxc'\n  - '.config/lxc'\n\n# container defaults (defaults.conf)\n# /etc/lxc/default.conf | ~/.config/lxc/default.conf\nlxc_network_type: veth\nlxc_network_link: lxcbr0\nlxc_network_bridge_type: bridge\nlxc_network_flags: up\nlxc_network_hwaddr: '00:16:3e:xx:xx:xx'\nlxc_network_ipv4_gateway: auto\nlxc_network_ipv6_gateway: auto\n\n# lxc.conf defaults\n# /etc/lxc/lxc.conf | ~/.config/lxc/lxc.conf\n\n# backend storage\n# lxc_bdev_lvm_vg: lxc\n# location in which all containers are stored\n# lxc_lxcpath: /var/lib/lxc\n# path to the default container configuration\n# lxc_default_config: /etc/lxc/default.conf ||  ~/.config/lxc/default.conf\n\n# lxc-net defaults\n# lxc_bridge_port: none\n\n# lxc_use_bridge: yes\n# lxc_bridge: lxcbr0\n# lxc_ipv4: 10.0.3.1/24\n# lxc_ipv6: fd4b:93da:8643:3046::1/64\n# lxc_ipv6_nat: yes\n\n# lxc_netmask: 255.255.255.0\n# lxc_network: 10.0.3.0/24\n#lxc_mtu: 1500\n\n# # if \"none\" no gateway will on the LXC bridge, nat must\n# # be \"false\" to use a gateway.\n# lxc_gateway: none\n\n# # lxc container nat enabled\n# lxc_nat: true  ## If \"true\" nat rules will be created with the lxc network.\n\n# lxc container dhcp settings\nlxc_dhcp_range: 10.0.3.2,10.0.3.253\nlxc_dhcp_max: 253\nlxc_dhcp_config: ''\nlxc_domain: 'lxc'\n\n```\n\n\n## Installation\n\n### Install with Ansible Galaxy\n\n```shell\nansible-galaxy install archf.lxc\n```\n\nBasic usage is:\n\n```yaml\n- hosts: all\n  roles:\n    - role: archf.lxc\n```\n\n### Install with git\n\nIf you do not want a global installation, clone it into your `roles_path`.\n\n```shell\ngit clone git@github.com:archf/ansible-lxc.git /path/to/roles_path\n```\n\nBut I often add it as a submdule in a given `playbook_dir` repository.\n\n```shell\ngit submodule add git@github.com:archf/ansible-lxc.git \u003cplaybook_dir\u003e/roles/lxc\n```\n\nAs the role is not managed by Ansible Galaxy, you do not have to specify the\ngithub user account.\n\nBasic usage is:\n\n```yaml\n- hosts: all\n  roles:\n  - role: lxc\n```\n\n## Ansible role dependencies\n\nNone.\n\n## License\n\nMIT.\n\n## Author Information\n\nFelix Archambault.\n\n## Role stack\n\n\nThis role was carefully selected to be part an ultimate deck of roles to manage\nyour infrastructure.\n\nAll roles' documentation is wrapped in this [convenient guide](http://127.0.0.1:8000/).\n\n\n---\nThis README was generated using ansidoc. This tool is available on pypi!\n\n```shell\npip3 install ansidoc\n\n# validate by running a dry-run (will output result to stdout)\nansidoc --dry-run \u003crolepath\u003e\n\n# generate you role readme file\nansidoc \u003crolepath\u003e\n```\n\nYou can even use it programatically from sphinx. Check it out.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchf%2Fansible-lxc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farchf%2Fansible-lxc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchf%2Fansible-lxc/lists"}