{"id":22147276,"url":"https://github.com/centerforopenscience/cos-ansible-base","last_synced_at":"2025-07-26T02:31:48.796Z","repository":{"id":16342396,"uuid":"19092169","full_name":"CenterForOpenScience/cos-ansible-base","owner":"CenterForOpenScience","description":"Our base ansible scripts for deployment and orchestration","archived":false,"fork":false,"pushed_at":"2018-03-19T10:54:27.000Z","size":993,"stargazers_count":24,"open_issues_count":7,"forks_count":21,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-14T05:19:02.845Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CenterForOpenScience.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"security.yml","support":null}},"created_at":"2014-04-24T01:58:56.000Z","updated_at":"2024-01-30T19:51:22.000Z","dependencies_parsed_at":"2022-08-03T13:00:14.076Z","dependency_job_id":null,"html_url":"https://github.com/CenterForOpenScience/cos-ansible-base","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/CenterForOpenScience%2Fcos-ansible-base","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CenterForOpenScience%2Fcos-ansible-base/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CenterForOpenScience%2Fcos-ansible-base/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CenterForOpenScience%2Fcos-ansible-base/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CenterForOpenScience","download_url":"https://codeload.github.com/CenterForOpenScience/cos-ansible-base/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227642219,"owners_count":17797850,"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":[],"created_at":"2024-12-01T23:15:47.502Z","updated_at":"2024-12-01T23:15:48.264Z","avatar_url":"https://github.com/CenterForOpenScience.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cos-ansible-base\n\n- Issue/Task tracking: https://huboard.com/CenterForOpenScience/cos-ansible-base\n\n## Requirements\n\n- ansible \u003e= 2.1\n- virtualbox\n- vagrant \u003e= 1.6\n- invoke (Python task execution library)\n- python \u003e= 2.7 or \u003e= 3.4 with pip\n- fwknop \u003e= 2.6.5\n- At least 2Gb of memory\n\n### Installing Ansible and Vagrant on Mac OSX with homebrew\n\nVirtualbox and Vagrant can be installed with homebrew cask. If you have homebrew installed, run the following from the project directory:\n\n```sh\n$ brew bundle\n```\n\n### Installing python requirements\n\nInvoke can be installed with pip\n\n```sh\n$ pip install invoke\n$ pip install -r requirements.txt\n```\n\n\n## Getting cos-ansible-base\n\nTo clone cos-ansible-base locally, run:\n\n```sh\n$ git clone https://github.com/CenterForOpenScience/cos-ansible-base --recursive\n```\n\nThe ``--recursive`` option ensures that all submodules will be cloned.\n\n## Vagrant setup\n\nOnce you have Vagrant and ansible installed, follow these steps:\n\n- Generate your ssh key with `ssh-keygen`\n\n```bash\n$ ssh-keygen\n```\n\n- Run `vagrant up \u003cmachine_to_run\u003e`. Then will start the VM provision with `invoke vprovision`. Use the `--limit` (or `-l`) option to limit to a specific group.\n\n```bash\n# Start the osf-staging server\n$ vagrant up osf-staging\n# Provision the osf-staging server\n$ invoke vprovision --limit osf-staging\n```\n\n\n### SSH\n\nTo ssh into your Vagrant box, run ``vagrant ssh \u003cbox-name\u003e``:\n\n```bash\n$ vagrant ssh osf-staging\n```\n\n## Generating passwords\n\nTo generate a password, run\n\n```bash\n$ invoke genpass\n```\n\nThis crypted password can be used by the generic-users role in a group_vars file.\n\n## Running playbooks\n\nPlaybooks can be run with the `ansible-playbook` command. You need to specify which inventory file with the `-i` option as well as a user with the `-u` option. Run in sudo mode with `-s`\n\n```bash\n$ ansible-playbook security.yml -i vagranthosts -u sloria -s\n```\n\nOr, using invoke for shorthand:\n\n```bash\n$ invoke play security.yml -i vagranthosts -u sloria\n```\n\n## Provisioning\n\nThe `site.yml` playbook is responsible for provisioning all servers in an inventory.\n\nRun it like so:\n\n```bash\n$ ansible-playbook site.yml -i vagranthosts -u sloria -s\n```\n\nThe above command runs the `site.yml` playbook using the `vagrant` inventory file with user `sloria` in sudo mode.\n\nOr, if you prefer to use invoke:\n\n```bash\n$ invoke provision -i vagranthosts -u sloria\n```\n\nNOTE: You can also provision the vagrant box by running `invoke vprovision` with no arguments.\n\nMany of the roles use variables defined in their `defaults/main.yml` file. You can override these on the command line with the `-e` option:\n\n```bash\n$ ansible-playbook site.yml -i vagranthosts -u sloria -e \"ssh_test=false\"\n```\n\nor, equivalently:\n\n```bash\n$ invoke provision -u sloria -e \"ssh_test=false\"\n```\n\nThe above would temporarily disable SSH configuration testing.\n\n\n\n## Setting up for Single Packet Authorization\n\nIf using encryption and HMAC keys, execute on client:\n\n```bash\nfwknop -A tcp/22 -a PUBLIC_CLIENT_IP -D TARGET_SERVER_IP --key-gen --use-hmac --save-rc-stanza\n ```\n\nPrint your newly generated keys:\n\n ```bash\n grep KEY ~/.fwknoprc\n ```\nAnd add to Single Packet Authorization Server access configuration /etc/fwknop/access.conf:\n\n ```\n SOURCE              ANY\n KEY_BASE64          [KEY]\n HMAC_KEY_BASE64     [HMAC_KEY]\n ```\n\n\n## Setting up for OSF deployment\n\nYou will need to set up agent forwarding in order to be able to properly authenticate with Github over SSH in ansible. To do so, add the following to your `~/.ssh/config/` file.\n\n\n```\nHost staging.osf.io\n    HostName 66.228.46.171\n    User sloria\n    ForwardAgent yes\n\nHost osf.io\n    HostName 69.164.210.152\n    User sloria\n    ForwardAgent yes\n```\n\n## Deployment\n\nThe `deploy.yml` script is used to deploy the OSF.\n\nTo deploy on staging:\n\n```bash\n$ invoke deploy_staging -u sloria\n```\n\nYou will be prompted for the branch to checkout on staging.\n\n\nTo deploy to production:\n\n```bash\n$ invoke deploy_production -u sloria\n```\n\nThis will deploy to the production server, checking out the master\nbranch from Github.\n\n### COS is Hiring!\n\nWant to help save science? Want to get paid to develop free, open source software? [Check out our openings!](http://cos.io/jobs)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcenterforopenscience%2Fcos-ansible-base","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcenterforopenscience%2Fcos-ansible-base","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcenterforopenscience%2Fcos-ansible-base/lists"}