{"id":15148696,"url":"https://github.com/jsf0/ansible-clone","last_synced_at":"2025-08-26T20:20:50.300Z","repository":{"id":239378093,"uuid":"602345702","full_name":"jsf0/ansible-clone","owner":"jsf0","description":"Generate an Ansible playbook that will duplicate an existing system","archived":false,"fork":false,"pushed_at":"2023-03-17T01:14:11.000Z","size":23,"stargazers_count":23,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T22:04:37.757Z","etag":null,"topics":["ansible","ansible-playbook","automation","freebsd","openbsd"],"latest_commit_sha":null,"homepage":"https://kernelpanic.life/software/cloning-a-system-with-ansible.html","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jsf0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-16T02:23:07.000Z","updated_at":"2025-03-07T20:37:27.000Z","dependencies_parsed_at":"2024-05-12T18:48:32.046Z","dependency_job_id":null,"html_url":"https://github.com/jsf0/ansible-clone","commit_stats":null,"previous_names":["jsf0/ansible-clone"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jsf0/ansible-clone","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsf0%2Fansible-clone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsf0%2Fansible-clone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsf0%2Fansible-clone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsf0%2Fansible-clone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsf0","download_url":"https://codeload.github.com/jsf0/ansible-clone/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsf0%2Fansible-clone/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268400669,"owners_count":24244445,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","ansible-playbook","automation","freebsd","openbsd"],"created_at":"2024-09-26T13:21:47.724Z","updated_at":"2025-08-02T13:40:09.293Z","avatar_url":"https://github.com/jsf0.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ansible-clone\n\nThis Python script will create an Ansible playbook that duplicates an existing Linux or BSD system. It will figure out all the currently installed packages and running services, and will include the contents of any config files you provide it. It will then create a playbook that will install all of these packages, enable the same services, and copy those file contents to the same paths.\n\nThe idea is that once you have a system configured the way you like it, you just run this tool and it will create a playbook that you can use to configure another system in the same way. \n\nSimilarly, you can use a playbook generated by `ansible-clone` to start managing a server's configuration with Ansible if it previously was not under any configuration management tool.\n\nCurrently it supports generating playbooks on the following operating systems:\n\n - OpenBSD\n - FreeBSD\n - Debian\n - Ubuntu\n - Linux Mint\n - Arch Linux\n - CentOS\n - Fedora\n - RHEL\n\n\n### usage\n\nTo use `ansible-clone`, you provide it with an INI file containing the paths to any files whose contents you want in the playbook, and the path to the playbook you will create:\n```\nansible-clone -c config_file_paths.ini -f playbook.yml\n```\n\nThis command above will load the file `config_file_paths.ini` and include the contents of all the config files found there in the playbook. The playbook will be written to `playbook.yml`\n\nThe file `config_file_paths.ini` here should look something like this:\n\n```\n[spectrwm.conf]\npath = /home/joe/.spectrwm.conf\n\n[pf.conf]\npath = /etc/pf.conf\n```\nThe contents of the files at these paths will be included in the resulting playbook.\n\n`ansible-clone` will automatically detect all installed packages and currently-enabled services, and include those in the playbook as well. You should be able to run this playbook on a fresh OS install, and configure the new system exactly like the old one.\n\n### Supporting new operating systems\n\nSupport for new running this on other operating systems can be added fairly easily. You will need to modify the following functions: \n\n`get_installed_packages()`\n\n`get_enabled_services()`\n\n\n### TODO\n\n- [ ] Write a man page\n- [ ] Fix all the roff formatting in that man page that I will have messed up the first time\n- [ ] Add some command line flags to optionally disable each function (e.g, ignore packages, services, or config files)\n- [X] Implement support for Linux. Will need to include various package managers, and systemctl to grab service info\n- [ ] Add support for including variables such as IP address, hostname, etc. \n- [ ] Add a Makefile\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsf0%2Fansible-clone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsf0%2Fansible-clone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsf0%2Fansible-clone/lists"}