ssh - Ansible: Install package with pip from a private git repo -
i trying install package private git repo using ansible's pip module way:
- name: install package pip: name='git+ssh://git@github.com/mycompany/my-repo.git#egg=0.1.0' virtualenv=/path/to/venv
but hangs when try provision vagrant, because prompts confirmation add key list of known hosts. indeed when run in vagrant:
pip install git+ssh://git@github.com/mycompany/my-repo.git#egg=0.1.0
it prompts confirmation add github know hosts , works fine.
if clone accept_hostkey=yes
:
- name: clone repo git: repo=git@github.com:mycompany/my-repo.git dest=/path/to/dest accept_hostkey=yes recursive=no
it works fine because accepts host key copied on vagrant. pip module there no such option, way around this? alternative clone , python setup.py install
i'd rather in 1 step pip.
the checkout
command hangs because github.com
not among known hosts of ansible user. should add github.com ssh key fingerprint /home/user/.ssh/known_hosts
file. fortunately, known_hosts
module available in ansible 1.9: http://docs.ansible.com/known_hosts_module.html
- known_hosts: path=/home/user/.ssh/known_hosts name=github.com key="|1|ba0yhihdbad9nswn12xsoyd8dfe=|evzbrcr46cycmx6qfrirztvwux4= ssh-rsa aaaab3nzac1yc2eaaaabiwaaaqeaq2a7hrgmdnm9tudbo9idswbk6tbqa+pxypcpy6rbtrttw7phkcckrpp0yvhp5hdeickr6pllvdbfolx9qusycov0wzfjijnlgeysdlljizhhbn2mujvsahqqzetyp81efzlqnnpht4evvuh7vfdesu84kezmd5qlwpxlmvu31/ymf+se8xhhtvksczifimwwog6mbuowf9nzpioasjb+weqquumpaaasxval72j+ux2b+2rpw3rct0eozqgqljl3rkrtjvdsje3jeavgq3lghszxy28g3skua2smvi/w4yce6gbodqntwlg7+wc604ydgxa8vjis5ap43jxiuffaaq=="
if using ansible < 1.9, may use standard ssh-keygen
commands:
- shell: ssh-keygen -l -f /home/user/.ssh/known_hosts -f github.com register: github_host_is_known - shell: ssh-keyscan -h github.com >> /home/user/.ssh/known_hosts when: github_host_is_known|failed
Comments
Post a Comment