/ansible-role-code-server

Ansible role to install and configure code-server (v3, v2 and v1).

MIT LicenseMIT

ansible-role-code-server

Ansible Role Build Status

This role installs and configures the latest or specified version of code-server, supporting v3, v2 and v1.

# Install the latest stable version of the role
ansible-galaxy install -f pallxk.code_server

# Install the latest development version of the role
ansible-galaxy install -f pallxk.code_server,master

To actually install code-server, refer to the section Example Playbook.

Note: The version of the role is irrelevant to the version of code-server you can install. Actually, it installs the latest version of code-server by default. And you can also use a lower-versioned role to install a higher-versioned code-server.
When there are changes to the role, the role version will get updated to the latest version number of code-server.
If you're having problems installing any version of code-server, please report the issue.

Requirements

None.

Role Variables

Variable Default Comment
code_server_ver (undefined) code-server release name on GitHub.
Defaults to the latest version (including pre-release).
code_server_install_prefix /usr/local Installation prefix for code-server.
code_server_data_dir {{ ansible_user_dir }}/.local/share/code-server Defaults to .local/share/code-server in the home directory of the remote user.
code_server_work_dir (undefined) Working directory.
Defaults to welcome screen if not set in v3 and v2.
Defaults to the home directory of the remote user in v1.
code_server_auth password Authentication with password or none.
Available for code-server v3 and v2.
code_server_password (undefined) Leave undefined to use auto-generated password.
Check it with journalctl -u code-server
code_server_user {{ ansible_user_id }} The user to run code-server.
Defaults to the user used in ansible ssh connection.
code_server_host 0.0.0.0
code_server_port 8080
code_server_tls_cert (undefined) Leave undefined to use self-signed certificate.
code_server_tls_cert_remote no Change to yes if you're using a certificate that's already in your server (e.g.: if you use Let's Encrypt)
code_server_tls_key (undefined) Leave undefined to use self-signed certificate.
code_server_tls_key_remote no Change to yes if you're using a key that's already in your server (e.g.: if you use Let's Encrypt)

Dependencies

None.

Example Playbook

#!/usr/bin/env ansible-playbook
---
- hosts: localhost
  gather_facts: yes
  roles:
    - name: pallxk.code_server
      code_server_password: SuperSecret
      code_server_user: "{{ ansible_user_id }}"
      code_server_host: 0.0.0.0
      code_server_port: 8443
      code_server_tls_cert: /etc/letsencrypt/live/example.com/fullchain.pem
      code_server_tls_key: /etc/letsencrypt/live/example.com/privkey.pem

License

The MIT License (MIT)

Author Information

pallxk testcab