diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 77f883fe82b2aa44f3a524d1f45dcd7d340c705d..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,34 +0,0 @@ -# VARIABLES -variables: - DOCKER_BUILDKIT: 1 - DOCKER_DRIVER: overlay2 - DOCKER_HOST: tcp://localhost:2375 - DOCKER_TLS_CERTDIR: "" - -########################################################################################################## - -## PIPELINE DEFINITION -stages: - - check - -########################################################################################################## - -### COMMON SECTION -.common: &common - variables: - GIT_DEPTH: 1 - ANSIBLE_FORCE_COLOR: "True" - before_script: - - chmod -R o-w ../ - -########################################################################################################## - -### TEST SECTION -test: - <<: *common - stage: check - image: registry.cyberbrain.pw/ansible/ansible - except: - - /^master$/ - script: - - find . -type d -exec ansible-lint --force-color -v -x '204' {} \; diff --git a/defaults/main.yml b/defaults/main.yml index 87ed0f68881baebb7958b91a5d989ead84ca0435..717d889798bf040c390e61e3a6ba6da45997ae14 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1 +1,2 @@ -locale: "C.UTF-8" +default_locale: "C.UTF-8" +locales: "en_US.UTF-8,ru_RU.UTF-8" diff --git a/meta/main.yml b/meta/main.yml index a83a580d543fdccc615302d0e8c847c1c3bcdc25..b42f1c824db199bbae1198005d50896da1d1f475 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,4 +1,6 @@ galaxy_info: + role_name: localepurge + namespace: dmitriysafronov author: Dmitriy Safronov description: Localepurge configuration # company: your company (optional) @@ -17,7 +19,7 @@ galaxy_info: # - CC-BY-4.0 license: LGPL-2.0-or-later - min_ansible_version: 2.9 + min_ansible_version: "2.12" # If this a Container Enabled role, provide the minimum Ansible Container version. # min_ansible_container_version: @@ -42,15 +44,16 @@ galaxy_info: platforms: - name: Ubuntu versions: - - focal - - bionic - - name: Linux Mint - versions: - - ulyana - - tricia + - all - name: Debian versions: - - buster + - all + - name: Fedora + versions: + - all + - name: OracleLinux + versions: + - all galaxy_tags: [] # List tags for your role here, one per line. A tag is a keyword that describes @@ -66,4 +69,4 @@ dependencies: # List your role dependencies here, one per line. Be sure to remove the '[]' above, # if you add dependencies to this list. -allow_duplicates: no +allow_duplicates: false diff --git a/tasks/ubuntu/localepurge.yml b/tasks/deb/main.yml similarity index 60% rename from tasks/ubuntu/localepurge.yml rename to tasks/deb/main.yml index 3097547c807be782c90f31f14513cdcadbf30e79..189cba4f75ac20e3f51f95f1896543403b608ff5 100644 --- a/tasks/ubuntu/localepurge.yml +++ b/tasks/deb/main.yml @@ -1,46 +1,46 @@ --- -- name: Set default locale to {{ locale }} - debconf: +- name: Set default locale to {{ default_locale }} + ansible.builtin.debconf: name: locales question: locales/default_environment_locale - value: "{{ locale }}" + value: "{{ default_locale }}" vtype: select # - name: Set exception for localepurge to {{ locale }} - debconf: + ansible.builtin.debconf: name: localepurge question: localepurge/nopurge - value: "{{ locale }}" + value: "{{ locales }}" vtype: multiselect - name: Generate locales - debconf: + ansible.builtin.debconf: name: locales question: locales/locales_to_be_generated - value: "{{ locale }}" + value: "{{ locales }}" vtype: multiselect # - name: Localepurge use dpkg feature - debconf: + ansible.builtin.debconf: name: localepurge question: localepurge/use-dpkg-feature value: 'True' vtype: boolean - name: Localepurge don't bother new locales - debconf: + ansible.builtin.debconf: name: localepurge question: localepurge/dontbothernew value: 'True' vtype: boolean - name: Localepurge show freed space - debconf: + ansible.builtin.debconf: name: localepurge question: localepurge/showfreedspace value: 'False' @@ -49,14 +49,21 @@ # - name: Install packages - apt: + ansible.builtin.apt: dpkg_options: 'force-confnew' state: present - update_cache: yes + update_cache: true pkg: - localepurge # -- name: Force locale to {{ locale }} - shell: update-locale --reset LANG={{ locale }} LC_ALL={{ locale }} +- name: Template a file to /etc/default/locale + ansible.builtin.copy: + content: | + LANG={{ default_locale }} + LC_ALL={{ default_locale }} + dest: /etc/default/locale + owner: root + group: root + mode: "0644" diff --git a/tasks/main.yml b/tasks/main.yml index 91e083e057ede8fdd0ee8b2166e10461dcea0541..67dbb84f2c605468d2a840693843979d34b7f97c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,6 +2,6 @@ # Ubuntu - name: Perform specific setup for Ubuntu, Debian & Linux Mint - include_tasks: ubuntu/main.yml - when: ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian' or ansible_distribution == 'Linux Mint' - tags: ubuntu + ansible.builtin.include_tasks: deb/main.yml + when: ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian' + tags: deb diff --git a/tasks/ubuntu/main.yml b/tasks/ubuntu/main.yml deleted file mode 100644 index 717d3529ccf2e935b0878f72fcfadacc96c95bf7..0000000000000000000000000000000000000000 --- a/tasks/ubuntu/main.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- - -# localepurge -- name: Install & configure localepurge - include_tasks: localepurge.yml - tags: localepurge